Have sh print out which signal terminated a child process.

This commit is contained in:
Andreas Kling 2018-11-01 01:11:00 +01:00
parent a685809e75
commit cddd2f37e9
Notes: sideshowbarker 2024-07-19 18:35:22 +09:00

View file

@ -148,7 +148,11 @@ static int runcmd(char* cmd)
if (WIFEXITED(wstatus)) {
//printf("Exited normally with status %d\n", WEXITSTATUS(wstatus));
} else {
printf("Exited abnormally\n");
if (WIFSIGNALED(wstatus)) {
printf("Terminated by signal %d\n", WTERMSIG(wstatus));
} else {
printf("Exited abnormally\n");
}
}
return retval;
}