From 2e39e89f37ae27e9acd0f9831a4bc8fb054a6f61 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Thu, 14 Sep 2023 17:45:13 +0200 Subject: [PATCH] keyboard handle --- src/hexdumper.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/hexdumper.py b/src/hexdumper.py index 7d36af0..9172e7e 100755 --- a/src/hexdumper.py +++ b/src/hexdumper.py @@ -135,4 +135,9 @@ def main(): file.close() if __name__ == "__main__": - main() + # when called directly (like executed from shell) + try: + main() + except KeyboardInterrupt: + # no need for an exception when the user presses ctrl c. + sys.exit(0)