diff --git a/yeeshell.c b/yeeshell.c index 772ab27..95c0836 100644 --- a/yeeshell.c +++ b/yeeshell.c @@ -250,7 +250,6 @@ 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 */ { @@ -265,11 +264,13 @@ 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; }