Graceful SIGINT handler.

Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
Arun Prakash Jana 2016-03-16 20:40:55 +05:30
parent 1d910977ad
commit 7179b8bd05

10
buku
View File

@ -27,6 +27,7 @@ import html.parser as HTMLParser
from http.client import HTTPConnection
from http.client import HTTPSConnection
from urllib.parse import urljoin, unquote
import signal
# Import libraries needed for encryption
try:
@ -588,6 +589,15 @@ def decrypt_file():
# SIGINT handler
def sigint_handler(signum, frame):
print('\nInterrupted.', file=sys.stderr)
sys.exit(1)
signal.signal(signal.SIGINT, sigint_handler)
# Main starts here
# ----------------
optlist = None