From ced979dd3117f222031a7ba327469ad6c20887ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Wed, 16 Apr 2025 15:24:42 +0200 Subject: [PATCH] fix(parsing/simple_cmd): report error the same way as everywhere else, prevent leak --- src/parser/simple_cmd/simple_cmd_parse.c | 4 ++-- test.sh | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/parser/simple_cmd/simple_cmd_parse.c b/src/parser/simple_cmd/simple_cmd_parse.c index 616b712..f98d83c 100644 --- a/src/parser/simple_cmd/simple_cmd_parse.c +++ b/src/parser/simple_cmd/simple_cmd_parse.c @@ -6,7 +6,7 @@ /* 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); } 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); } diff --git a/test.sh b/test.sh index a432b3c..c1d7d44 100755 --- a/test.sh +++ b/test.sh @@ -626,4 +626,13 @@ minishell: syntax error near unexpected token `>' 2 EOF +when_run <