From cd4e60b55935d01706787d146b9b3652f239246f Mon Sep 17 00:00:00 2001 From: Jonathan Neidel Date: Tue, 10 Feb 2026 21:04:08 +0100 Subject: [PATCH] Handle EOF (ctrl-d) gracefully Instead of the traceback it currently throws. --- filetags/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/filetags/__init__.py b/filetags/__init__.py index f37bd52..e583ac1 100755 --- a/filetags/__init__.py +++ b/filetags/__init__.py @@ -2277,7 +2277,12 @@ def ask_for_tags_text_version(vocabulary, upto9_tags_for_shortcuts, hint_str, ta print_tag_shortcut_with_numbers(hint_str, tag_list) logging.debug("interactive mode: asking for tags ...") - entered_tags = input(colorama.Style.DIM + 'Tags: ' + colorama.Style.RESET_ALL).strip() + try: + entered_tags = input(colorama.Style.DIM + 'Tags: ' + colorama.Style.RESET_ALL).strip() + except EOFError: + logging.info("Received EOF") + sys.exit(0) + return extract_tags_from_argument(entered_tags)