From 3c9a70b761ac3d4a5ace8c877200295e0da79594 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Mon, 13 Jun 2016 18:06:44 -0700 Subject: [PATCH] fix debug mode on Windows --- netlib/debug.py | 8 +++++--- test/netlib/test_debug.py | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netlib/debug.py b/netlib/debug.py index 303a2f6fe..a395afcb0 100644 --- a/netlib/debug.py +++ b/netlib/debug.py @@ -1,5 +1,6 @@ from __future__ import (absolute_import, print_function, division) +import os import sys import threading import signal @@ -93,6 +94,7 @@ def dump_stacks(signal, frame, file=sys.stdout): print("\n".join(code), file=file) -def register_info_dumpers(): # pragma: no cover - signal.signal(signal.SIGUSR1, dump_info) - signal.signal(signal.SIGUSR2, dump_stacks) +def register_info_dumpers(): + if os.name != "nt": + signal.signal(signal.SIGUSR1, dump_info) + signal.signal(signal.SIGUSR2, dump_stacks) diff --git a/test/netlib/test_debug.py b/test/netlib/test_debug.py index b9315c7fc..51710da0d 100644 --- a/test/netlib/test_debug.py +++ b/test/netlib/test_debug.py @@ -18,3 +18,7 @@ def test_dump_stacks(): def test_sysinfo(): assert debug.sysinfo() + + +def test_register_info_dumpers(): + debug.register_info_dumpers()