Browse Source

update do_pipe

master
杨浩然 3 years ago
parent
commit
22a951d0b6
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      yeeshell.c

+ 2
- 2
yeeshell.c View File

@ -250,6 +250,7 @@ int do_pipe(char **pipe_arg_1, char **pipe_arg_2)
exit(0); exit(0);
} }
} }
waitpid(prog_1, NULL, 0);
if ((prog_2 = fork()) == 0) /* Child process 2 */ 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); exit(0);
} }
} }
waitpid(prog_2, NULL, 0);
close(fds[0]); close(fds[0]);
close(fds[1]); close(fds[1]);
waitpid(prog_1, NULL, 0);
waitpid(prog_2, NULL, 0);
return 1; return 1;
} }

Loading…
Cancel
Save