diff options
| author | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-14 09:33:29 +0100 |
|---|---|---|
| committer | Nathan Reiner <nathan@nathanreiner.xyz> | 2023-02-14 09:33:29 +0100 |
| commit | dffe48ee9dec21e3dbcb374f938d747da8d66f12 (patch) | |
| tree | f4a71f3ade01e2ece4dae580081a9834672911d5 /smash/exec.c | |
| parent | cf625ea48ac09b8b484f90e5971e2d8001aa76de (diff) | |
add set env variables
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]); |