diff --git a/yeeshell.c b/yeeshell.c index eb46177..772ab27 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -250,6 +250,7 @@ int do_pipe(char **pipe_arg_1, char **pipe_arg_2) exit(0); } } + waitpid(prog_1, NULL, 0); if ((prog_2 = fork()) == 0) /* Child process 2 */ { @@ -264,12 +265,11 @@ int do_pipe(char **pipe_arg_1, char **pipe_arg_2) exit(0); } } + waitpid(prog_2, NULL, 0); close(fds[0]); close(fds[1]); - waitpid(prog_1, NULL, 0); - waitpid(prog_2, NULL, 0); return 1; }