From dffe48ee9dec21e3dbcb374f938d747da8d66f12 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Tue, 14 Feb 2023 09:33:29 +0100 Subject: add set env variables --- smash/exec.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'smash/exec.c') 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]); -- cgit v1.2.3-70-g09d2