diff options
Diffstat (limited to 'src/exec.c')
| -rw-r--r-- | src/exec.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -5,6 +5,7 @@ #include <sys/wait.h> #include "syntax.h" +#include "utils.h" void execute_command_pipeline(Pipeline pipeline, int stdin_fd, int stdout_fd); @@ -73,6 +74,8 @@ ExecutableCommand process_pl_command(PlCommand pl_cmd) { close(ps_pipe_fds[1]); char pname[64]; snprintf(pname, sizeof(pname), "/dev/fd/%d", ps_pipe_fds[0]); + push_to_IntVec(&parent_open_fds, ps_pipe_fds[0]); + push_to_StrVec(&arg_vec, strdup(pname)); break; default: exit(67); @@ -122,10 +125,6 @@ void execute_command_pipeline(Pipeline pipeline, int stdin_fd, int stdout_fd) { int trunk_fd = stdin_fd; int pgid = -1; - - signal(SIGTTIN, SIG_IGN); - signal(SIGTTOU, SIG_IGN); - for (int i = 0; i < pipeline.count; i++) { PlCommand cmd = *get_from_Pipeline(&pipeline, i); ExecutableCommand exec_cmd = process_pl_command(cmd); @@ -161,5 +160,7 @@ void execute_command_pipeline(Pipeline pipeline, int stdin_fd, int stdout_fd) { } void execute_pipeline_tree(PipelineTree pltree) { + signal(SIGTTIN, SIG_IGN); + signal(SIGTTOU, SIG_IGN); execute_command_pipeline(*pltree.root, STDIN_FILENO, STDOUT_FILENO); } |
