diff options
author | vm <vm@vm.vm> | 2020-05-25 20:25:10 +0200 |
---|---|---|
committer | vm <vm@vm.vm> | 2020-05-25 20:25:10 +0200 |
commit | 9b1a0928001aacc4420617ab1b6c84dcb16f7e75 (patch) | |
tree | b1ec1bc640944973a292720daa56db8faaae0d23 | |
parent | 41775b83ad93264b487bf0dc353b145922ee6d73 (diff) | |
download | betriebssysteme-9b1a0928001aacc4420617ab1b6c84dcb16f7e75.tar.gz betriebssysteme-9b1a0928001aacc4420617ab1b6c84dcb16f7e75.zip |
stuff
-rw-r--r-- | 02_exercise/builtins.c | 6 | ||||
-rw-r--r-- | 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; |