Ctrl-C handler, how to override?
Michael Hudson
mwh at python.net
Fri Oct 4 05:02:24 EDT 2002
Bruce Edge <edgebruce at yahoo.com> writes:
> How the @#$!$ do override the SIGINT handler?
>
> I can create handlers for other signals, but not for SIGINT:
>
> >>> getsignal(SIGINT)
> <built-in function default_int_handler>
> >>> def handler(signum, frame):
> ... print "got signal", signum
> >>> signal(SIGINT, handler)
> 1
> >>> getsignal(SIGINT)
> <function handler at 0x81466f4>
>
> ...Looks OK so far, but Ctrl-C's still call the default handler:
>
> >>>
> KeyboardInterrupt
> >>>
> KeyboardInterrupt
You are being messed around by readline. It'll work when not in
interactive mode.
Cheers,
M.
--
Or here's an even simpler indicator of how much C++ sucks: Print
out the C++ Public Review Document. Have someone hold it about
three feet above your head and then drop it. Thus you will be
enlightened. -- Thant Tessman
More information about the Python-list
mailing list