output child WEXITSTATUS/WTERMSIG on abnormal termination - st - simple terminal
HTML git clone https://git.parazyd.org/st
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
DIR commit 096b125db7ec254002a049ef3a5c1204bd7f0ad9
DIR parent d7bf023b2f2d41cb6983bb3ce2c6d1bf049150b3
HTML Author: Lauri Tirkkonen <lotheac@iki.fi>
Date: Tue, 11 Dec 2018 11:43:03 +0200
output child WEXITSTATUS/WTERMSIG on abnormal termination
Diffstat:
M st.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
---
DIR diff --git 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);
}