summaryrefslogtreecommitdiff
path: root/redes/exec.c
diff options
context:
space:
mode:
authorÁkos Kőrösi <korakos99@gmail.com>2026-05-21 09:51:42 +0200
committerÁkos Kőrösi <korakos99@gmail.com>2026-05-21 09:51:42 +0200
commitde11428a45eb36dfa1c39fc59b56d0273fbec4a0 (patch)
tree48e13974c493b6f00e3c551fff1cbd6977d1dfc4 /redes/exec.c
parented02ec0d1628b4eaf56e751b29532426ef229b89 (diff)
got new flow working(?)
Diffstat (limited to 'redes/exec.c')
-rw-r--r--redes/exec.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/redes/exec.c b/redes/exec.c
index 964b0a0..8fb42b8 100644
--- a/redes/exec.c
+++ b/redes/exec.c
@@ -1,13 +1,17 @@
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
+#include <signal.h>
+#include <sys/wait.h>
#include "syntax.h"
void execute_cmd(ExecutableCommand cmd, int* pgid) {
- printf("ok\n");
+ printf("Ok\n");
+ fflush(stdout);
+
pid_t pid = fork();
if (pid == 0) {
@@ -100,9 +104,15 @@ void execute_command_pipeline(Pipeline pipeline) {
int trunk_fd = STDIN_FILENO;
int pgid = -1;
- size_t i = 0;
+ printf("Starting pipeline of length %d\n", pipeline.count);
+ fflush(stdout);
+
+ signal(SIGTTIN, SIG_IGN);
+ signal(SIGTTOU, SIG_IGN);
for (int i = 0; i < pipeline.count; i++) {
+ printf("Processing cmd %d\n", i);
+ fflush(stdout);
PlCommand cmd = *get_from_Pipeline(&pipeline, i);
ExecutableCommand exec_cmd = process_pl_command(cmd);
exec_cmd.stdin_fd = trunk_fd;
@@ -130,7 +140,7 @@ void execute_command_pipeline(Pipeline pipeline) {
}
void execute_pipeline_tree(PipelineTree pltree) {
- printf("Hello");
+ printf("Hello\n");
fflush(stdout);
execute_command_pipeline(*pltree.root);
}