summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sleekxmpp/xmlstream/xmlstream.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sleekxmpp/xmlstream/xmlstream.py b/sleekxmpp/xmlstream/xmlstream.py
index 630e68bf..cc192715 100644
--- a/sleekxmpp/xmlstream/xmlstream.py
+++ b/sleekxmpp/xmlstream/xmlstream.py
@@ -199,11 +199,15 @@ class XMLStream(object):
self.auto_reconnect = True
self.is_client = False
- if hasattr(signal, 'SIGHUP'):
- signal.signal(signal.SIGHUP, self._handle_kill)
- if hasattr(signal, 'SIGTERM'):
- # Used in Windows
- signal.signal(signal.SIGTERM, self._handle_kill)
+ try:
+ if hasattr(signal, 'SIGHUP'):
+ signal.signal(signal.SIGHUP, self._handle_kill)
+ if hasattr(signal, 'SIGTERM'):
+ # Used in Windows
+ signal.signal(signal.SIGTERM, self._handle_kill)
+ except:
+ logging.debug("Can not set interrupt signal handlers. " + \
+ "SleekXMPP is not running from a main thread.")
def _handle_kill(self, signum, frame):
"""