diff options
| author | Lauri Tirkkonen <lotheac@iki.fi> | 2018-12-11 11:43:03 +0200 | 
|---|---|---|
| committer | terriblephrases <terriblephrases@gmail.com> | 2018-12-16 02:19:10 +0100 | 
| commit | e651f316420d4366605cd5614b4b6ede46ea451a (patch) | |
| tree | 2b49ceb1b8a1c81abbaf3ef4846c9bb68a1e0bd4 | |
| parent | 3061ebd7e17053bb0a928eda868136a4d5f59997 (diff) | |
output child WEXITSTATUS/WTERMSIG on abnormal termination
| -rw-r--r-- | st.c | 6 | 
1 files changed, 4 insertions, 2 deletions
@@ -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);  }  | 
