This commit is contained in:
Camille Chauvet 2023-02-28 13:17:26 +01:00
parent ca18dd4205
commit 07bc37cc71

View File

@ -110,7 +110,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd)
else if (ft_strcmp(cmd->executable, "export") == 0) else if (ft_strcmp(cmd->executable, "export") == 0)
return_code = (export(data->env,cmd->args + 1, cmd->fd_out)); return_code = (export(data->env,cmd->args + 1, cmd->fd_out));
else if (ft_strcmp(cmd->executable, "cd") == 0) 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) if (ft_strcmp(cmd->executable, "unset") == 0)
return_code = (unset(data->env, cmd->args, cmd->fd_out)); return_code = (unset(data->env, cmd->args, cmd->fd_out));
else if (ft_strcmp(cmd->executable, "echo") == 0) 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; return_code = -2;
} }
} }
if (return_code != -1) if (return_code != -1 && return_code != -2)
{ {
cmd->executable = NULL; cmd->executable = NULL;
data->exit_code = return_code; data->exit_code = return_code;