From f2ffaa70eb299c5e2bb7c181d2910337de7e99d3 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Mon, 20 Jan 2025 17:13:37 +0100 Subject: Fix some errors --- src/execute_cmd.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/execute_cmd.c') diff --git a/src/execute_cmd.c b/src/execute_cmd.c index e2b9d66..ac0d5b1 100644 --- a/src/execute_cmd.c +++ b/src/execute_cmd.c @@ -6,7 +6,7 @@ /* By: chuhlig +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/12/17 19:21:35 by chuhlig #+# #+# */ -/* Updated: 2025/01/19 19:15:46 by chuhlig ### ########.fr */ +/* Updated: 2025/01/20 15:54:43 by dkaiser ### ########.fr */ /* */ /* ************************************************************************** */ @@ -51,8 +51,8 @@ int execute_cmd(t_cmd *cmd, t_env **env) original_std[1] = dup(STDOUT_FILENO); original_std[0] = dup(STDIN_FILENO); - create_files(cmd->create_files); - if (handle_redirections(cmd->redirs) == -1) + result = create_files(cmd->create_files); + if (result != EXIT_SUCCESS || handle_redirections(cmd->redirs) == -1) { establish_pipeline(original_std[0], original_std[1]); return (EXIT_FAILURE); @@ -63,6 +63,8 @@ int execute_cmd(t_cmd *cmd, t_env **env) establish_pipeline(original_std[0], original_std[1]); return (result); } + if (result != EXIT_SUCCESS) + return (result); return (exec_cmd(cmd, env, original_std, EXIT_SUCCESS)); } -- cgit v1.2.3