diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-02-13 13:55:48 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-02-13 13:55:48 +0100 |
commit | 7bc7d05ad0aff3f3bb2453be691010f7ea46da3a (patch) | |
tree | de62ecfc6676aea432612367412fab20acbccb73 | |
parent | bcf3826fa633c9a0864752582bce01b711ec772e (diff) |
Handle ctrl-c
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rwxr-xr-x | fb.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -14,6 +14,7 @@ import os import pycurl import re import shutil +import signal import subprocess import sys import tarfile @@ -397,6 +398,7 @@ class FBClient: self.config["useragent"] = "fb-client/%s" % self.version def run(self): + signal.signal(signal.SIGINT, self.handle_ctrl_c) defaultConfigFile = os.path.join(xdg.BaseDirectory.xdg_config_home, 'fb-client/config') parser = argparse.ArgumentParser( @@ -462,6 +464,10 @@ class FBClient: with make_temp_directory() as self.tempdir: functions[self.args.mode]() + def handle_ctrl_c(self, signal, frame): + print("\nReceived signal, aborting!") + sys.exit(1) + def makedirs(self, path): dirname = os.path.dirname(path) try: |