Timeline for Why would Ctrl-C behave differently than kill -2
Current License: CC BY-SA 3.0
2 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 13, 2012 at 23:34 | comment | added | Alan Curry | To perfectly match the behavior of the tty interrupt character, you should send the SIGINT to the process group. Instead of kill -2 $PID use kill -2 -$PGID. (The minus in front of the PGID tells kill to interpret it as a PGID instead of a PID). You can find the PGID with ps j. The PGID is the same as the lead process's PID so your command probably ends up looking the same except for the -. | |
| Aug 13, 2012 at 23:23 | history | answered | Mike Deck | CC BY-SA 3.0 |