/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/17 19:21:35 by chuhlig #+# #+# */
-/* Updated: 2025/01/20 15:43:41 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 20:04:31 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
original_std[1] = dup(STDOUT_FILENO);
original_std[0] = dup(STDIN_FILENO);
- result = create_files(cmd->create_files);
- if (result != EXIT_SUCCESS || handle_redirections(cmd->redirs) == -1)
+ create_files(cmd->create_files);
+ if (handle_redirections(cmd->redirs) == -1)
{
establish_pipeline(original_std[0], original_std[1]);
return (EXIT_FAILURE);
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));
}
}
waitpid(pid, &status, 0);
establish_pipeline(original_std[0], original_std[1]);
- return (WEXITSTATUS(status));
+ return ((status >> 8) & 255);
}
/* By: chuhlig <chuhlig@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/17 19:15:49 by chuhlig #+# #+# */
-/* Updated: 2025/01/20 19:12:49 by chuhlig ### ########.fr */
+/* Updated: 2025/01/20 20:07:11 by chuhlig ### ########.fr */
/* */
/* ************************************************************************** */
fd = open(path, flags, mode);
if (fd < 0)
- perror("open");
+ perror(path);
return (fd);
}