diff options
author | ThinkChaos <ThinkChaos@users.noreply.github.com> | 2020-01-11 13:18:54 +0100 |
---|---|---|
committer | ThinkChaos <ThinkChaos@users.noreply.github.com> | 2020-01-11 13:18:54 +0100 |
commit | c416ac051705a2f6a976f6c0015d91b5dbc573b1 (patch) | |
tree | 6195d48d663a768c412bafe7cdc7a8e0cbd98d55 | |
parent | ffbe558b6cf6a40b687806c03b58edb4325bbb89 (diff) | |
download | mitmproxy-c416ac051705a2f6a976f6c0015d91b5dbc573b1.tar.gz mitmproxy-c416ac051705a2f6a976f6c0015d91b5dbc573b1.tar.bz2 mitmproxy-c416ac051705a2f6a976f6c0015d91b5dbc573b1.zip |
Exit on SIGTERM instead of prompting
-rw-r--r-- | mitmproxy/tools/_main.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/mitmproxy/tools/_main.py b/mitmproxy/tools/_main.py index b98bbe90..c1dd6179 100644 --- a/mitmproxy/tools/_main.py +++ b/mitmproxy/tools/_main.py @@ -113,12 +113,12 @@ def run( opts.update(**extra(args)) loop = asyncio.get_event_loop() - for signame in ('SIGINT', 'SIGTERM'): - try: - loop.add_signal_handler(getattr(signal, signame), getattr(master, "prompt_for_exit", master.shutdown)) - except NotImplementedError: - # Not supported on Windows - pass + try: + loop.add_signal_handler(signal.SIGINT, getattr(master, "prompt_for_exit", master.shutdown)) + loop.add_signal_handler(signal.SIGTERM, master.shutdown) + except NotImplementedError: + # Not supported on Windows + pass # Make sure that we catch KeyboardInterrupts on Windows. # https://stackoverflow.com/a/36925722/934719 |