Graceful SIGINT handler.
Signed-off-by: Arun Prakash Jana <engineerarun@gmail.com>
This commit is contained in:
parent
1d910977ad
commit
7179b8bd05
10
buku
10
buku
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user