From b2b99d20d43588fd8e44a58d4d437a79b1ff89a2 Mon Sep 17 00:00:00 2001 From: ValdikSS Date: Sun, 7 May 2017 13:42:30 +0300 Subject: [PATCH] Re-raise SystemExit and KeyboardInterrupt to catch it in caller function --- blockcheck.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/blockcheck.py b/blockcheck.py index 1795f4b..e147989 100755 --- a/blockcheck.py +++ b/blockcheck.py @@ -261,6 +261,9 @@ def _get_url(url, proxy=None, ip=None): if 'CERTIFICATE_VERIFY_FAILED' in str(e): return (-1, '') return (0, '') + except (KeyboardInterrupt, SystemExit) as e: + # re-raise exception to send it to caller function + raise e except Exception as e: print("[☠] Неизвестная ошибка:", repr(e)) return (0, '') @@ -662,6 +665,9 @@ def test_dpi(): print("\tПробуем способ «{}» на {}".format(testname, dpisite)) try: result = _dpi_send(test.get('ip'), 80, test.get('data'), test.get('fragment_size'), test.get('fragment_count')) + except (KeyboardInterrupt, SystemExit) as e: + # re-raise exception to send it to caller function + raise e except Exception as e: print("[☠] Ошибка:", repr(e)) else: