diff --git a/coub-dl.py b/coub-dl.py index 2f4b821..d98d894 100644 --- a/coub-dl.py +++ b/coub-dl.py @@ -15,6 +15,7 @@ from argparse import ArgumentParser from functools import wraps from tempfile import mkdtemp from shutil import rmtree +from signal import signal, SIGINT @@ -230,8 +231,15 @@ class temporary_directory: rmtree(self.name) +@call_verbose(before_message='\nExiting!\n', after_message='') +def sigint_handler(signal, frame): + exit() + + if __name__ == '__main__': + signal(SIGINT, sigint_handler) + args = parse_cmd_arguments() VERBOSE = False if args.nonverbose else True