From 9b1a0928001aacc4420617ab1b6c84dcb16f7e75 Mon Sep 17 00:00:00 2001 From: vm Date: Mon, 25 May 2020 20:25:10 +0200 Subject: stuff --- 02_exercise/builtins.c | 6 +++++- 02_exercise/shell.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/02_exercise/builtins.c b/02_exercise/builtins.c index 4ab4c7c..8b23c74 100644 --- a/02_exercise/builtins.c +++ b/02_exercise/builtins.c @@ -62,6 +62,9 @@ void builtin_wait(process p, bool bind) { perror("Could not wait for process"); } } else { + if (bind) { + printf("[%i] ", WEXITSTATUS(status)); + } else { printf("[%i] TERMINATED\n", current_pid); if (WIFEXITED(status)) { printf("[%i] exited normally with status: %i\n", current_pid, @@ -76,10 +79,11 @@ void builtin_wait(process p, bool bind) { printf("[%i] exited (not sure why), exit status: %i\n", current_pid, WEXITSTATUS(status)); } + } } signal(SIGINT, SIG_DFL); } } arrayRelease(pids); -} \ No newline at end of file +} diff --git a/02_exercise/shell.c b/02_exercise/shell.c index 03ff6b3..2452347 100644 --- a/02_exercise/shell.c +++ b/02_exercise/shell.c @@ -14,7 +14,6 @@ process *processes; void signal_handler(int signal) { - printf("Received signal %d", signal); if (signal == SIGINT) { for (size_t i = 0; i < arrayLen(processes); ++i) { pid_t pid = processes[i].pid; -- cgit v1.2.3-54-g00ecf