From 07bc37cc710b540a2365e04f935a393e25b708de Mon Sep 17 00:00:00 2001 From: Camille Chauvet Date: Tue, 28 Feb 2023 13:17:26 +0100 Subject: [PATCH] fix --- execution.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/execution.c b/execution.c index 0e61b42..0c06ad0 100644 --- a/execution.c +++ b/execution.c @@ -110,7 +110,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd) else if (ft_strcmp(cmd->executable, "export") == 0) return_code = (export(data->env,cmd->args + 1, cmd->fd_out)); else if (ft_strcmp(cmd->executable, "cd") == 0) - return_code = (move_folder(cmd->args[1], cmd->fd_out)); + return_code = (move_folder(cmd->args + 1, cmd->fd_out)); if (ft_strcmp(cmd->executable, "unset") == 0) return_code = (unset(data->env, cmd->args, cmd->fd_out)); else if (ft_strcmp(cmd->executable, "echo") == 0) @@ -124,7 +124,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd) return_code = -2; } } - if (return_code != -1) + if (return_code != -1 && return_code != -2) { cmd->executable = NULL; data->exit_code = return_code;