summaryrefslogtreecommitdiff
path: root/st.c
diff options
context:
space:
mode:
authorLauri Tirkkonen <lotheac@iki.fi>2018-12-11 11:43:03 +0200
committerterriblephrases <terriblephrases@gmail.com>2018-12-16 02:19:10 +0100
commite651f316420d4366605cd5614b4b6ede46ea451a (patch)
tree2b49ceb1b8a1c81abbaf3ef4846c9bb68a1e0bd4 /st.c
parent3061ebd7e17053bb0a928eda868136a4d5f59997 (diff)
output child WEXITSTATUS/WTERMSIG on abnormal termination
Diffstat (limited to 'st.c')
-rw-r--r--st.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/st.c b/st.c
index bc761ba..5a2a898 100644
--- a/st.c
+++ b/st.c
@@ -738,8 +738,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);
}