S
Steven D'Aprano
I'd like to perform a task when the user interrupts my application with
Ctrl-Z on Linux. I tried installing a signal handler:
import signal
def handler(signalnum, stackframe):
print "Received signal %d" % signalnum
signal.signal(signal.SIGSTOP, handler)
But I got a RuntimeError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: (22, 'Invalid argument')
This isn't documented:
http://docs.python.org/library/signal.html#signal.signal
Is there a way to catch SIGSTOP?
Ctrl-Z on Linux. I tried installing a signal handler:
import signal
def handler(signalnum, stackframe):
print "Received signal %d" % signalnum
signal.signal(signal.SIGSTOP, handler)
But I got a RuntimeError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
RuntimeError: (22, 'Invalid argument')
This isn't documented:
http://docs.python.org/library/signal.html#signal.signal
Is there a way to catch SIGSTOP?