From 9ee5d3a73e2af1c9d7ddd92f97384ab1871ce3fb Mon Sep 17 00:00:00 2001 From: Szymon Borecki Date: Sat, 26 Aug 2023 19:31:35 +0200 Subject: [PATCH] Fix a bug where a KeyboardInterrupt would trigger an error and crash the app --- software/script/chameleon_cli_main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/software/script/chameleon_cli_main.py b/software/script/chameleon_cli_main.py index a150e08..b58eb65 100755 --- a/software/script/chameleon_cli_main.py +++ b/software/script/chameleon_cli_main.py @@ -106,13 +106,13 @@ class ChameleonCLI: try: cmd_str = self.session.prompt( ANSI(self.get_prompt())).strip() + cmd_strs = cmd_str.replace( + "\r\n", "\n").replace("\r", "\n").split("\n") + cmd_str = cmd_strs.pop(0) except EOFError: closing = True except KeyboardInterrupt: closing = True - cmd_strs = cmd_str.replace( - "\r\n", "\n").replace("\r", "\n").split("\n") - cmd_str = cmd_strs.pop(0) if closing or cmd_str in ["exit", "quit", "q", "e"]: print("Bye, thank you. ^.^ ")