diff --git a/src/parser/parser_get_commands.c b/src/parser/parser_get_commands.c index 6725b8c..cbf115e 100644 --- a/src/parser/parser_get_commands.c +++ b/src/parser/parser_get_commands.c @@ -14,7 +14,7 @@ static int is_command_token(t_token *token) { - return (token->type < 3 || redirect_token_type(token)); + return (token->type < 3 || token->type == T_REDIRECT_IN || token->type ==T_HEREDOC || token->type == T_REDIRECT_OUT || token->type == T_APPEND_OUT); } t_list *parser_get_commands(t_minishell *minishell) diff --git a/src/redirect/redirect_get_inputs.c b/src/redirect/redirect_get_inputs.c index 1ea9f8b..a44a6fe 100644 --- a/src/redirect/redirect_get_inputs.c +++ b/src/redirect/redirect_get_inputs.c @@ -23,6 +23,8 @@ t_list *redirect_get_inputs(t_list *list) while (current) { token = (t_token *)current->content; + if (token->type == T_PIPE || token->type == T_EOF) + break ; if (token->type != T_REDIRECT_IN && token->type != T_HEREDOC) { current = current->next; diff --git a/src/redirect/redirect_get_outputs.c b/src/redirect/redirect_get_outputs.c index 18cc0dc..9383bf6 100644 --- a/src/redirect/redirect_get_outputs.c +++ b/src/redirect/redirect_get_outputs.c @@ -23,6 +23,8 @@ t_list *redirect_get_outputs(t_list *list) while (current) { token = (t_token *)current->content; + if (token->type == T_PIPE || token->type == T_EOF) + break; if (token->type != T_REDIRECT_OUT && token->type != T_APPEND_OUT) { current = current->next;