From f2a45a7ca317c3f11ca598e1ce92b42a6dee562d Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Wed, 17 Apr 2019 18:55:51 -0700 Subject: [PATCH] Check for KeyboardInterrupt --- fedit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fedit.py b/fedit.py index d94b810..c088166 100644 --- a/fedit.py +++ b/fedit.py @@ -19,6 +19,7 @@ BOOT_DIR = "/boot" ETC_DIR = "/etc" # ----- Exit Codes ----- +E_INTERRUPT = 1 E_NOEDITORFOUND = 2 E_NOFILESELECTED = 3 @@ -200,7 +201,10 @@ if __name__ == "__main__": else locate_files(args.patterns) ) - selected_file = run_fzf(files) + try: + selected_file = run_fzf(files) + except KeyboardInterrupt: + exit(E_INTERRUPT) if selected_file != "": cmd = gen_editor_cmd(selected_file)