mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-22 15:37:45 +00:00
Merge pull request #3782 from ThinkChaos/fix_sigterm
Exit on SIGTERM instead of prompting
This commit is contained in:
commit
6e57d60f7d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user