From 51724a7257144c160c92867f09858fbfdd33ddbd Mon Sep 17 00:00:00 2001 From: Ronak Date: Mon, 19 Jan 2026 22:27:49 +0530 Subject: [PATCH] Fix the fork and Pipe handling --- src/src/executor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/src/executor.c b/src/src/executor.c index f62d73b..2f438aa 100644 --- a/src/src/executor.c +++ b/src/src/executor.c @@ -23,6 +23,10 @@ void execute_commands(Command *cmd){ } pid_t pid = fork(); + if (pid < 0) { + perror("fork failed"); + return; + } if (pid == 0){ if (fd_in!=0) dup2(fd_in, 0); if (curr->next) dup2(fd[1],1);