While using python\'s cmd.Cmd to create a custom CLI, how do I tell the handler to abort the current line and give me a new prompt?
Here is a minimal example:
You can check out the signal module: http://docs.python.org/library/signal.html
signal
import signal oldSignal = None def handler(signum, frame): global oldSignal if signum == 2: print "ctrl+c!!!!" else: oldSignal() oldSignal = signal.signal(signal.SIGINT, handler)