Philipp Hörist pushed to branch master at gajim / gajim

Commits:
4731e849 by Philipp Hörist at 2018-05-17T20:59:22+02:00
Move signal code into gajim.py

The reason for signal.signal(signal.SIGPIPE, signal.SIG_DFL)

Python ignores SIGPIPE by default ( signal(SIGPIPE, SIG_IGN) )
Write on a socket return then an error 32 EPIPE, which naturally
turns into an exception.

signal.SIG_DFL restores normal UNIX behavior

- - - - -


2 changed files:

- gajim/common/connection.py
- gajim/gajim.py


Changes:

=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -55,10 +55,6 @@ except Exception:
     randomsource = random.Random()
     randomsource.seed()
 
-import signal
-if os.name != 'nt':
-    signal.signal(signal.SIGPIPE, signal.SIG_DFL)
-
 if os.name == 'nt':
     import certifi
 import OpenSSL.crypto


=====================================
gajim/gajim.py
=====================================
--- a/gajim/gajim.py
+++ b/gajim/gajim.py
@@ -78,7 +78,7 @@ def _init_gtk():
     from gajim.application import GajimApplication
 
     application = GajimApplication()
-    _install_terminate(application)
+    _install_sginal_handlers(application)
     application.run(sys.argv)
 
 
@@ -100,13 +100,15 @@ def _set_proc_title():
             libc.setproctitle('gajim')
 
 
-def _install_terminate(application):
+def _install_sginal_handlers(application):
     def sigint_cb(num, stack):
         print('SIGINT/SIGTERM received')
         application.quit()
     # ^C exits the application normally
     signal.signal(signal.SIGINT, sigint_cb)
     signal.signal(signal.SIGTERM, sigint_cb)
+    if os.name != 'nt':
+        signal.signal(signal.SIGPIPE, signal.SIG_DFL)
 
 
 def main():



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/4731e8491bfe1ff1213ecc4a117c5b2d3454fbea

---
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/4731e8491bfe1ff1213ecc4a117c5b2d3454fbea
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to