Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Apr 14, 2024. It is now read-only.

Commit 5992bb6

Browse filesBrowse files
committed
async.init: signal initialization failure is now cought, and a warning message is printed to inform about it
1 parent e527a5d commit 5992bb6
Copy full SHA for 5992bb6

File tree

1 file changed

+7
-1
lines changed
Filter options

1 file changed

+7
-1
lines changed

‎__init__.py

Copy file name to clipboardExpand all lines: __init__.py
+7-1Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ def _init_signals():
1212
"""Assure we shutdown our threads correctly when being interrupted"""
1313
import signal
1414
import thread
15+
import sys
1516

1617
prev_handler = signal.getsignal(signal.SIGINT)
1718
def thread_interrupt_handler(signum, frame):
@@ -21,7 +22,12 @@ def thread_interrupt_handler(signum, frame):
2122
raise KeyboardInterrupt()
2223
# END call previous handler
2324
# END signal handler
24-
signal.signal(signal.SIGINT, thread_interrupt_handler)
25+
try:
26+
signal.signal(signal.SIGINT, thread_interrupt_handler)
27+
except ValueError:
28+
# happens if we don't try it from the main thread
29+
print >> sys.stderr, "Failed to setup thread-interrupt handler. This is usually not critical"
30+
# END exception handling
2531

2632

2733
#} END init

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.