From fc277de5dd73fad456b11bc9afe0cf9174a0d3f7 Mon Sep 17 00:00:00 2001 From: Bastian Krause Date: Tue, 19 Oct 2021 14:44:35 +0200 Subject: [PATCH] remote/client: exit with 1 on KeyboardInterrupt When concatenating commands with '&&' or using 'set -e', a keyboard interrupt should lead to no further commands being executed. To allow this, rather exit with 1 than 0 on keyboard interrupt. Fixes: ef401836 ("remote/client: catch common errors and show a help message") Signed-off-by: Bastian Krause --- CHANGES.rst | 1 + labgrid/remote/client.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 9887dd301..c17f9cc3b 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,7 @@ Bug fixes in 0.5.0 - Fixed a bug where using ``labgrid-client io get`` always returned ``low`` when reading a ``sysfsgpio``. +- Fix labgrid-client exit code on keyboard interrupt. Breaking changes in 0.5.0 ~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/labgrid/remote/client.py b/labgrid/remote/client.py index f01beb126..3aec145eb 100755 --- a/labgrid/remote/client.py +++ b/labgrid/remote/client.py @@ -1904,7 +1904,7 @@ def main(): print(f"{parser.prog}: error: {e}", file=sys.stderr) exitcode = 1 except KeyboardInterrupt: - exitcode = 0 + exitcode = 1 except Exception: # pylint: disable=broad-except traceback.print_exc() exitcode = 2