From df6b67a8f2ac13d980fb78134ebe47571c8ea6dc Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 12 Apr 2022 22:46:27 +0200 Subject: [PATCH] sys/shell: print error code of commands --- sys/shell/shell.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/shell/shell.c b/sys/shell/shell.c index 45bbcc2784bf..15243668c9de 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -330,7 +330,14 @@ static void handle_input_line(const shell_command_t *command_list, char *line) shell_post_command_hook(res, argc, argv); } else { - handler(argc, argv); + int res = handler(argc, argv); + if (res < 0) { + if (IS_ACTIVE(DEVELHELP)) { + puts(strerror(-res)); + } else { + printf("error: %d\n", res); + } + } } } else {