Commit baaef09c authored by abenoit's avatar abenoit
Browse files

wait error msg

parent b2313de5
......@@ -21,6 +21,7 @@ enum e_retcode
FD_ERROR,
EXT_CMD_ERROR,
FORK_ERROR,
WAIT_ERROR,
_EXEC_ERROR_,
AMBIG_REDIR,
CMD_NOT_FOUND,
......
......@@ -54,6 +54,7 @@ int parent_pipe_end(t_command *cur_command, t_xe *xe, int fd_in, int proc)
int i;
int ret;
int tmp;
int wait_ret;
ret = SUCCESS;
if (fd_in != STDIN_FILENO)
......@@ -73,7 +74,9 @@ int parent_pipe_end(t_command *cur_command, t_xe *xe, int fd_in, int proc)
i = 0;
while (i < proc)
{
wait(&xe->stat_loc);
wait_ret = wait(&xe->stat_loc);
if (wait_ret == ERROR)
return (WAIT_ERROR);
if (WIFSIGNALED(xe->stat_loc))
{
xe->stat_loc = WTERMSIG(xe->stat_loc);
......
......@@ -3,9 +3,13 @@
static int exec_parent_end(pid_t *pid, t_xe *xe)
{
int ret;
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, SIG_IGN);
waitpid(*pid, &xe->stat_loc, 0);
ret = waitpid(*pid, &xe->stat_loc, 0);
if (ret == ERROR)
return (WAIT_ERROR);
if (WIFSIGNALED(xe->stat_loc))
{
xe->stat_loc = WTERMSIG(xe->stat_loc);
......
......@@ -51,7 +51,8 @@ static int err_output(int err_code, t_xe *xe)
"Error reading a directory in PATH",
"fd issue",
"external command error",
"fork failure"};
"fork failure",
"wait failure"};
(void)xe;
ft_putstr_fd("error: ", STDERR_FILENO);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment