summaryrefslogtreecommitdiff
path: root/redes/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'redes/exec.c')
-rw-r--r--redes/exec.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/redes/exec.c b/redes/exec.c
index 437dfbe..964b0a0 100644
--- a/redes/exec.c
+++ b/redes/exec.c
@@ -1,3 +1,4 @@
+#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
@@ -5,11 +6,12 @@
void execute_cmd(ExecutableCommand cmd, int* pgid) {
-
+
+ printf("ok\n");
pid_t pid = fork();
if (pid == 0) {
-
+
if (*pgid == -1) {
setpgid(0, 0);
} else {
@@ -19,7 +21,7 @@ void execute_cmd(ExecutableCommand cmd, int* pgid) {
dup2(cmd.stdin_fd, STDIN_FILENO);
dup2(cmd.stdout_fd, STDOUT_FILENO);
- for (int i = 0; i < cmd.open_fds.count; i++) {
+ for (int i = 0; i < cmd.redirects.count; i++) {
FdRedirect fd_rd = *get_from_FdRedirectVec(&cmd.redirects, i);
dup2(fd_rd.to, fd_rd.redirected);
}
@@ -128,5 +130,7 @@ void execute_command_pipeline(Pipeline pipeline) {
}
void execute_pipeline_tree(PipelineTree pltree) {
+ printf("Hello");
+ fflush(stdout);
execute_command_pipeline(*pltree.root);
}