From: Lauri Tirkkonen Date: Tue, 11 Dec 2018 09:43:03 +0000 (+0200) Subject: output child WEXITSTATUS/WTERMSIG on abnormal termination X-Git-Url: https://git.danieliu.xyz/?a=commitdiff_plain;h=096b125db7ec254002a049ef3a5c1204bd7f0ad9;p=st.git output child WEXITSTATUS/WTERMSIG on abnormal termination --- diff --git a/st.c b/st.c index a51d19c..b8e6077 100644 --- a/st.c +++ b/st.c @@ -731,8 +731,10 @@ sigchld(int a) if (pid != p) return; - if (!WIFEXITED(stat) || WEXITSTATUS(stat)) - die("child finished with error '%d'\n", stat); + if (WIFEXITED(stat) && WEXITSTATUS(stat)) + die("child exited with status %d\n", WEXITSTATUS(stat)); + else if (WIFSIGNALED(stat)) + die("child terminated due to signal %d\n", WTERMSIG(stat)); exit(0); }