mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(parsing/simple_cmd): report error the same way as everywhere else, prevent leak
This commit is contained in:
parent
d652f32cff
commit
ced979dd31
2 changed files with 11 additions and 2 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/04/15 10:38:47 by khais #+# #+# */
|
/* Created: 2025/04/15 10:38:47 by khais #+# #+# */
|
||||||
/* Updated: 2025/04/15 14:15:02 by khais ### ########.fr */
|
/* Updated: 2025/04/16 15:26:54 by khais ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -42,6 +42,6 @@ t_cmd *minishell_simple_cmd_parse(t_minishell *app, t_wordlist **tokens)
|
||||||
t_redirect_add_back(&simple->value.simple->redirections, redir);
|
t_redirect_add_back(&simple->value.simple->redirections, redir);
|
||||||
}
|
}
|
||||||
if (!simple->value.simple->words)
|
if (!simple->value.simple->words)
|
||||||
return (cmd_destroy(simple), parse_error(app, (*tokens)->word), NULL);
|
return (cmd_destroy(simple), ft_errno(FT_EERRNO), NULL);
|
||||||
return (simple);
|
return (simple);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
9
test.sh
9
test.sh
|
|
@ -626,4 +626,13 @@ minishell: syntax error near unexpected token `>'
|
||||||
2
|
2
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
when_run <<EOF "single pipe char"
|
||||||
|
|
|
||||||
|
echo \$?
|
||||||
|
EOF
|
||||||
|
expecting <<"EOF"
|
||||||
|
minishell: syntax error near unexpected token `|'
|
||||||
|
2
|
||||||
|
EOF
|
||||||
|
|
||||||
finalize
|
finalize
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue