Reputation: 792
So I've been using control-z to stop my python scripts, but I recently noticed they were still active in the activity monitor and can only terminate them there. Control-C doesn't work and only prints out ^C. Perhaps the combo got remapped? Any suggestions on how I can figure this out.
Upvotes: 1
Views: 1780
Reputation: 44334
By default CTRL+Z
suspends a process and places it into background, see man bash
and search for job control.
On the OS X standard bash, CTRL+C
sends a SIGINT
(interrupt signal) to the foreground process but also prints ^C
. SIGINT
can be ignored or handled by the running process.
By default python handles SIGINT
and converts it to a a KeyboardException
If your scripts handle a general exception like except Exception:
or similar (a very bad idea) then it could ignore the CTRL+C
.
Check your scripts for signal handling and general exception handling.
To check for remapping on the terminal type stty -a
and look for cchars
and you should see intr = ^C;
and susp = ^Z;
.
Upvotes: 1