diff options
Diffstat (limited to 'smash/exec.c')
| -rw-r--r-- | smash/exec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/smash/exec.c b/smash/exec.c index b37576a..779fccd 100644 --- a/smash/exec.c +++ b/smash/exec.c @@ -1,4 +1,7 @@ #include "exec.h" +#include "parser.h" +#include "builtin.h" +#include "variable.h" #include "../lib/sys/execve.h" #include "../lib/sys/fork.h" @@ -13,9 +16,6 @@ #include "../lib/malloc/malloc.h" #include "../lib/list/list.h" -#include "parser.h" -#include "builtin.h" - void print_call(char **argv) { while (*argv) { @@ -89,6 +89,9 @@ void exec(char *line) } if (exp->next) dup2(pipefd[1][PIPE_IN], STDOUT_FD); + else if (get_end_fd() != STDOUT_FD) + dup2(get_end_fd(), STDOUT_FD); + close(pipefd[1][PIPE_OUT]); close(pipefd[1][PIPE_IN]); |