diff --git a/src/parser/redirect/redirect_parse.c b/src/parser/redirect/redirect_parse.c index 0edd9a5..f32e574 100644 --- a/src/parser/redirect/redirect_parse.c +++ b/src/parser/redirect/redirect_parse.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/15 10:13:58 by khais #+# #+# */ -/* Updated: 2025/04/16 13:56:59 by khais ### ########.fr */ +/* Updated: 2025/04/16 14:10:13 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,15 +29,13 @@ t_redirect *minishell_redirect_parse(t_minishell *app, t_wordlist **tokens) while ((*tokens) != NULL && is_redir((*tokens)->word)) { redir_operator = wordlist_pop(tokens); - if ((*tokens) == NULL) + if ((*tokens) != NULL && (*tokens)->word->token_type == WORD_TOKEN) + redir_specifier = wordlist_pop(tokens); + else { worddesc_destroy(redir_operator); return (ft_errno(FT_EERRNO), redirect_destroy(redir_list), NULL); } - if ((*tokens)->word->token_type == WORD_TOKEN) - redir_specifier = wordlist_pop(tokens); - else - return (ft_errno(FT_EERRNO), redirect_destroy(redir_list), NULL); new_redir = redir_from_words(redir_operator, redir_specifier, app); t_redirect_add_back(&redir_list, new_redir); } diff --git a/test.sh b/test.sh index 36c646f..f83ff4c 100755 --- a/test.sh +++ b/test.sh @@ -613,4 +613,13 @@ parsed command ╰─ redirections = (empty redir list) EOF +when_run <" +> > > > +echo \$? +EOF +expecting <<"EOF" +minishell: syntax error near unexpected token `>' +2 +EOF + finalize