From ba4192bf8d64c171a25c7b955c6930e0ca63ed39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kha=C3=AFs=20COLIN?= Date: Tue, 1 Apr 2025 15:58:34 +0200 Subject: [PATCH] export: set correct exit status --- src/executing/simple_cmd/builtin_export.c | 4 +++- test.sh | 6 ++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/executing/simple_cmd/builtin_export.c b/src/executing/simple_cmd/builtin_export.c index 214346c..64260cf 100644 --- a/src/executing/simple_cmd/builtin_export.c +++ b/src/executing/simple_cmd/builtin_export.c @@ -6,7 +6,7 @@ /* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/04/01 14:00:32 by khais #+# #+# */ -/* Updated: 2025/04/01 15:53:06 by khais ### ########.fr */ +/* Updated: 2025/04/01 15:58:28 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -32,6 +32,7 @@ static void single_export(char *arg, t_minishell *app) ft_dprintf(STDERR_FILENO, "minishell: export: `%s': not a valid identifier\n", arg); free2(key, value); + app->last_return_value = 1; } else if (env_set_entry(&app->env, key, value) == NULL) ft_perror("minishell: export"); @@ -45,6 +46,7 @@ t_builtin_type builtin_export(t_simple_cmd *cmd, t_minishell *app) i = 1; arg = wordlist_get(cmd->words, i++); + app->last_return_value = 0; while (arg != NULL) { single_export(arg->word, app); diff --git a/test.sh b/test.sh index de273f0..e6fcefd 100755 --- a/test.sh +++ b/test.sh @@ -307,25 +307,31 @@ EXTRAENV=-i when_run <