Ignore and Notice Keyboard Interrupts
0
Updated over 10 years ago (29 Mar 2008 at 04:35 AM)
recent activity
In Brief | Need to disable keyboard interrupts for a while, and maybe enable them later? Here you go. |
Language | Python |
# 's
1import signal
2
3def IgnoreKeyboardInterrupt():
4 """
5 Sets the response to a SIGINT (keyboard interrupt) to ignore.
6 """
7 return signal.signal(signal.SIGINT,signal.SIG_IGN)
8
9def NoticeKeyboardInterrupt():
10 """
11 Sets the response to a SIGINT (keyboard interrupt) to the
12 default (raise KeyboardInterrupt).
13 """
14 return signal.signal(signal.SIGINT, signal.default_int_handler)
Need to disable keyboard interrupts for a while, and maybe enable them later? Here you go.
Add a Comment