If I send a SIGTERM
signal to a process using the kill
command, I expect an exit code, but I always get 0 (zero) when running the below command after killing a process:
echo $?
According to the answer in this post, I should get 143 when sending a SIGTERM
to a process: Always app Java end with "Exit 143" Ubuntu
But I don´t get that exit code. Why?
The exit code you get is for the kill
command itself. 0 means it succeeded, i.e. the other process got the signal you sent it. kill
just doesn't report the exit status for the process, since it can't even be sure the other process exited as a result of the signal it sent.