[ovs-dev] [PATCH V7 02/16] python tests: Register signal handlers only on supported types on Windows
Paul Boca
pboca at cloudbasesolutions.com
Fri Jul 15 14:21:22 UTC 2016
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
V7: Simplified the signal handlers code
---
python/ovs/fatal_signal.py | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/python/ovs/fatal_signal.py b/python/ovs/fatal_signal.py
index 14605ac..73e4be6 100644
--- a/python/ovs/fatal_signal.py
+++ b/python/ovs/fatal_signal.py
@@ -16,6 +16,7 @@ import atexit
import os
import signal
import sys
+
import ovs.vlog
_hooks = []
@@ -128,9 +129,13 @@ def _init():
global _inited
if not _inited:
_inited = True
+ if sys.platform == "win32":
+ signals = [signal.SIGTERM, signal.SIGINT]
+ else:
+ signals = [signal.SIGTERM, signal.SIGINT, signal.SIGHUP,
+ signal.SIGALRM]
- for signr in (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)
--
2.7.2.windows.1
More information about the dev
mailing list