From 2e71f8e0204a768726c2b690210ca6f6884b9fc8 Mon Sep 17 00:00:00 2001 From: Robert Spralja Date: Tue, 29 Mar 2022 16:08:46 +0200 Subject: [PATCH 1/2] Updated Keyboard Interupt behaviour Now prints `\nKeyboard Interrupted` --- src/pychart/runner.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pychart/runner.py b/src/pychart/runner.py index 06e4f0f..cf1891b 100644 --- a/src/pychart/runner.py +++ b/src/pychart/runner.py @@ -42,7 +42,7 @@ def run_prompt(): print(result) except KeyboardInterrupt: - print("Keyboard Interrupt") + print("\nKeyboard Interrupted") exit() From d08425b7b08c1238d5baf1d336b8ea66f3e1c9b3 Mon Sep 17 00:00:00 2001 From: Robert Spralja Date: Tue, 29 Mar 2022 16:11:28 +0200 Subject: [PATCH 2/2] Added support for EOF (CTRL-D) Just prints newline and exits (modeled after the behaviour of the Python interactive console) --- src/pychart/runner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pychart/runner.py b/src/pychart/runner.py index cf1891b..97aa856 100644 --- a/src/pychart/runner.py +++ b/src/pychart/runner.py @@ -44,6 +44,10 @@ def run_prompt(): except KeyboardInterrupt: print("\nKeyboard Interrupted") exit() + + except EOFError: + print() + exit() def run_file(filename: str):