From 67250421bc093b640652a33c291d2c0e226e7588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=B5=A9=E7=84=B6?= <10195501441@stu.ecnu.edu.cn> Date: Tue, 23 Mar 2021 13:55:39 +0800 Subject: [PATCH] FINAL final version --- yeeshell.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; }