[ovs-dev] [PATCH V6 02/17] python tests: Register signal handlers only on supported types on Windows

Alin Serdean aserdean at cloudbasesolutions.com
Wed Jul 6 16:23:16 UTC 2016


The code is sound but looks a bit messy. What do you think about?
@@ -15,6 +15,7 @@
 import atexit
 import os
 import signal
+import sys

 import ovs.vlog

@@ -129,8 +130,12 @@ def _init():
     if not _inited:
         _inited = True

-        for signr in (signal.SIGTERM, signal.SIGINT,
-                      signal.SIGHUP, signal.SIGALRM):
# Add OS specific interrupt signals
+        if sys.platform == "win32":
+            signals = [signal.SIGTERM, signal.SIGINT]
+        else:
+            signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP, signal.SIGALRM]
+
+        for signr in signals:
             if signal.getsignal(signr) == signal.SIG_DFL:
                 signal.signal(signr, _signal_handler)
         atexit.register(_atexit_handler)

Alin.

> -----Mesaj original-----
> De la: dev [mailto:dev-bounces at openvswitch.org] În numele Paul Boca
> Trimis: Wednesday, July 6, 2016 3:38 PM
> Către: dev at openvswitch.org
> Subiect: [ovs-dev] [PATCH V6 02/17] python tests: Register signal handlers
> only on supported types on Windows
> 
> SIGHUP and SIGALRM are not available on Windows.
> 
> Signed-off-by: Paul-Daniel Boca <pboca at cloudbasesolutions.com>
> ---
> V2: Fixed Python function inet_open_active, treat WSAEWOULDBLOCK error
> as
>     EINPROGRESS on Windows
> V3: No changes
> V4: No changes
> V5: No changes
> V6: No changes
> ---
>  python/ovs/fatal_signal.py | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 


More information about the dev mailing list