From 42e1b718a266cc5f6f2e0277f77bca12708c6cda Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Wed, 14 Aug 2024 17:39:42 +0200 Subject: [PATCH] fixed the list issue --- Makefile | 4 ++-- ast/src/from_node/from_node.c | 4 ++-- exec/src/run_ast.c | 8 +------- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4ab67fa3..e847fc39 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/08/12 17:53:35 by rparodi ### ########.fr # +# Updated: 2024/08/14 17:36:13 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -44,7 +44,7 @@ endif endif # TODO: ADD THIS WHEN FINISHING THIS: -CFLAGS_ADDITIONAL += -DNVALGRIND +# CFLAGS_ADDITIONAL += -DNVALGRIND CFLAGS_ADDITIONAL += -O0 -Wno-cpp # TODO: REMOVE THIS WHEN FINISHING THIS: diff --git a/ast/src/from_node/from_node.c b/ast/src/from_node/from_node.c index d32d67d5..887db60c 100644 --- a/ast/src/from_node/from_node.c +++ b/ast/src/from_node/from_node.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */ -/* Updated: 2024/08/12 16:35:07 by maiboyer ### ########.fr */ +/* Updated: 2024/08/14 17:37:41 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -469,7 +469,7 @@ t_error build_sym_list(t_parse_node self, t_const_str input, t_ast_node *out) } else if (ts_node_field_id_for_child(self, i) == field_op) { - temp = ts_node_symbol(ts_node_child(self, i)); + temp = ts_node_grammar_symbol(ts_node_child(self, i)); if (temp == anon_sym_PIPE_PIPE) ret->data.list.op = AST_LIST_OR; if (temp == anon_sym_AMP_AMP) diff --git a/exec/src/run_ast.c b/exec/src/run_ast.c index 31e05f21..58893b8d 100644 --- a/exec/src/run_ast.c +++ b/exec/src/run_ast.c @@ -6,7 +6,7 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/11 17:22:29 by maiboyer #+# #+# */ -/* Updated: 2024/08/13 17:08:05 by maiboyer ### ########.fr */ +/* Updated: 2024/08/14 17:39:16 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -577,7 +577,6 @@ t_error run_list(t_ast_list *list, t_state *state, t_list_result *out) if (list == NULL || state == NULL || out == NULL) return (ERROR); append = NULL; - printf("LIST\n"); if (list->right->kind == AST_COMMAND) append = &list->right->data.command.suffixes_redirections; if (list->right->kind == AST_PIPELINE) @@ -595,9 +594,6 @@ t_error run_list(t_ast_list *list, t_state *state, t_list_result *out) right = -1; if (_run_get_exit_code(list->left, state, &left)) return (ERROR); - printf("left == %i\n", left); - printf("(list->op == AST_LIST_AND && left == 0) == %s\n", (list->op == AST_LIST_AND && left == 0) ? "true" : "false"); - printf("(list->op == AST_LIST_OR && left != 0) == %s\n", (list->op == AST_LIST_OR && left != 0) ? "true" : "false"); if ((list->op == AST_LIST_OR && left != 0) || (list->op == AST_LIST_AND && left == 0)) { if (_run_get_exit_code(list->right, state, &right)) @@ -852,8 +848,6 @@ t_error _spawn_cmd_and_run(t_vec_str args, t_vec_ast redirection, t_state *state info = (t_spawn_info){}; if (cmd_pipe.input != NULL) info.stdin = fd(cmd_pipe.input); - if (cmd_pipe.input != NULL && !(cmd_pipe.input->perms & FD_READ)) - printf("PERMISSION ERROR for %s !\n", cmd_pipe.input->name); if (cmd_pipe.create_output) info.stdout = piped(); i = 0;