Properly set exit code for killed processed.

This commit is contained in:
Enrico Fraccaroli (Galfurian)
2023-08-22 16:32:43 -04:00
parent c82779f1af
commit 452aa40770
4 changed files with 40 additions and 23 deletions
+5
View File
@@ -766,6 +766,11 @@ int main(int argc, char *argv[])
}
if (blocking) {
waitpid(cpid, &status, 0);
if (WIFSIGNALED(status)) {
printf(FG_RED "\nExit status %d, killed by signal %d\n" FG_RESET, WEXITSTATUS(status), WTERMSIG(status));
} else if (WIFSTOPPED(status)) {
printf(FG_YELLOW "\nExit status %d, stopped by signal %d\n" FG_RESET, WEXITSTATUS(status), WSTOPSIG(status));
}
}
}
// Free up the memory reserved for the arguments.