Show More
@@ -124,16 +124,21 b' def create_inputhook_qt4(mgr, app=None):' | |||
|
124 | 124 | ignore_CTRL_C() |
|
125 | 125 | got_kbdint[0] = True |
|
126 | 126 | mgr.clear_inputhook() |
|
127 | ||
|
128 | # This generates a second SIGINT so the user doesn't have to | |
|
129 | # press CTRL+C twice to get a clean prompt. | |
|
130 | # | |
|
131 | # Since we can't catch the resulting KeyboardInterrupt here | |
|
132 | # (because this is a ctypes callback), we use a timer to | |
|
133 | # generate the SIGINT after we leave this callback. | |
|
134 | # | |
|
135 | # Unfortunately this doesn't work on Windows (SIGINT kills | |
|
136 | # Python and CTRL_C_EVENT doesn't work). | |
|
127 | 137 | if(os.name == 'posix'): |
|
128 | 138 | pid = os.getpid() |
|
129 | print("^C") | |
|
130 | ||
|
131 | 139 | if(not sigint_timer[0]): |
|
132 | sigint_timer[0] = threading.Timer(.01, | |
|
133 |
|
|
|
134 | args=[pid, signal.SIGINT] | |
|
135 | ) | |
|
136 | ||
|
140 | sigint_timer[0] = threading.Timer(.01, os.kill, | |
|
141 | args=[pid, signal.SIGINT] ) | |
|
137 | 142 | sigint_timer[0].start() |
|
138 | 143 | else: |
|
139 | 144 | print("\nKeyboardInterrupt - Ctrl-C again for new prompt") |
General Comments 0
You need to be logged in to leave comments.
Login now