From 954c6c07da63ae06e0dc4cadc5534926e1a69e40 Mon Sep 17 00:00:00 2001 From: Martin Hoyer Date: Wed, 15 May 2024 17:26:26 +0200 Subject: [PATCH] Fix shell exit on expected errors --- src/targetcli/targetcli_shell.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/targetcli/targetcli_shell.py b/src/targetcli/targetcli_shell.py index 2d2bd7d..bd1a8f8 100644 --- a/src/targetcli/targetcli_shell.py +++ b/src/targetcli/targetcli_shell.py @@ -308,11 +308,11 @@ def main(): if not is_root: shell.con.display("You are not root, disabling privileged commands.\n") - try: - while not shell._exit: + while not shell._exit: + try: shell.run_interactive() - except (RTSLibError, ExecutionError) as msg: - shell.log.error(str(msg)) + except (RTSLibError, ExecutionError) as msg: # noqa: PERF203 - would otherwise exit shell + shell.log.error(str(msg)) if shell.prefs['auto_save_on_exit'] and is_root: shell.log.info("Global pref auto_save_on_exit=true")