SIGINT signals are now handled nicely instead of crashing
This commit is contained in:
parent
1c4a18e671
commit
68426271f0
@ -15,6 +15,7 @@ from argparse import ArgumentParser
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
from signal import signal, SIGINT
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -230,8 +231,15 @@ class temporary_directory:
|
|||||||
rmtree(self.name)
|
rmtree(self.name)
|
||||||
|
|
||||||
|
|
||||||
|
@call_verbose(before_message='\nExiting!\n', after_message='')
|
||||||
|
def sigint_handler(signal, frame):
|
||||||
|
exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
signal(SIGINT, sigint_handler)
|
||||||
|
|
||||||
args = parse_cmd_arguments()
|
args = parse_cmd_arguments()
|
||||||
VERBOSE = False if args.nonverbose else True
|
VERBOSE = False if args.nonverbose else True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user