fix(execution): Reimplemented the redirection logic

This commit is contained in:
Jean 2026-01-29 18:18:04 +01:00
parent a98161d885
commit ec63be42e5
4 changed files with 75 additions and 32 deletions

View file

@ -14,8 +14,6 @@
#include "../utils/ast/ast.h"
#include "../utils/hash_map/hash_map.h"
// Refactored: delegates to helpers in execution_helpers.c
#include "execution_helpers.h"
@ -33,6 +31,7 @@ int execution(struct ast *ast, struct hash_map *vars)
struct ast_command *command = ast_get_command(ast);
if (!expand(command, vars))
fprintf(stderr, "Error: Variable expansion failed\n");
return exec_ast_command(command, vars);
}
case AST_IF:
@ -41,8 +40,6 @@ int execution(struct ast *ast, struct hash_map *vars)
return exec_ast_list(ast_get_list(ast), vars);
case AST_AND_OR:
return exec_ast_and_or(ast_get_and_or(ast), vars);
case AST_REDIR:
return exec_ast_redir(ast_get_redir(ast), vars);
default:
return 127;
}