summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--02_exercise/builtins.c6
-rw-r--r--02_exercise/shell.c1
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;