From cddd2f37e95ef87e47b06eeb83bf54a6454aebc1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 1 Nov 2018 01:11:00 +0100 Subject: [PATCH] Have sh print out which signal terminated a child process. --- Userland/sh.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Userland/sh.cpp b/Userland/sh.cpp index f218ae7290b..264a748cf70 100644 --- a/Userland/sh.cpp +++ b/Userland/sh.cpp @@ -148,7 +148,11 @@ static int runcmd(char* cmd) if (WIFEXITED(wstatus)) { //printf("Exited normally with status %d\n", WEXITSTATUS(wstatus)); } else { - printf("Exited abnormally\n"); + if (WIFSIGNALED(wstatus)) { + printf("Terminated by signal %d\n", WTERMSIG(wstatus)); + } else { + printf("Exited abnormally\n"); + } } return retval; }