2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

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@cloudbasesolutions.com>
Acked-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Signed-off-by: Gurucharan Shetty <guru@ovn.org>
This commit is contained in:
Paul Boca
2016-08-02 17:45:39 +00:00
committed by Gurucharan Shetty
parent 36d516346a
commit 8229f855fc

View File

@@ -129,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)