From 9fe878bbecd470f76ff60bf5e9a90729c72aceed Mon Sep 17 00:00:00 2001 From: Bananymous Date: Tue, 1 Aug 2023 14:24:36 +0300 Subject: [PATCH] Shell: Print if the process exited because of a signal --- userspace/Shell/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/userspace/Shell/main.cpp b/userspace/Shell/main.cpp index 8af6561aa..36952f3a1 100644 --- a/userspace/Shell/main.cpp +++ b/userspace/Shell/main.cpp @@ -395,7 +395,10 @@ int execute_command(BAN::Vector& args) if (tcsetpgrp(0, getpid()) == -1) ERROR_RETURN("tcsetpgrp", 1); - return status; + if (WIFSIGNALED(status)) + fprintf(stderr, "Terminated by signal %d\n", WTERMSIG(status)); + + return WEXITSTATUS(status); } return 0;