From 71e3206b1916889bd59c7554dd4feb737a374ad3 Mon Sep 17 00:00:00 2001 From: Alexander Bersenev Date: Wed, 27 Jun 2018 13:33:51 +0500 Subject: [PATCH] check if signal exists before placing it. It can absent in some OSes, like Windows --- mtprotoproxy.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mtprotoproxy.py b/mtprotoproxy.py index 39d7afe..cc2e608 100755 --- a/mtprotoproxy.py +++ b/mtprotoproxy.py @@ -66,12 +66,12 @@ except (ValueError, OSError): except ImportError: pass +if hasattr(signal, 'SIGUSR1'): + def debug_signal(signum, frame): + import pdb + pdb.set_trace() -def debug_signal(signum, frame): - import pdb - pdb.set_trace() - -signal.signal(signal.SIGUSR1, debug_signal) + signal.signal(signal.SIGUSR1, debug_signal) if len(sys.argv) > 1: config = runpy.run_path(sys.argv[1])