diff --git a/src/common/shell/commander/commander.c b/src/common/shell/commander/commander.c index 4091e78..59caec3 100644 --- a/src/common/shell/commander/commander.c +++ b/src/common/shell/commander/commander.c @@ -101,7 +101,7 @@ internal inline CMDError get_command_output(FILE *fp, } strcat(out_buf, out); - } else { + } else if (out_handling == SHELL_OUTPUT_PRINT) { printf("%s", out); } } diff --git a/src/common/shell/commander/commander.h b/src/common/shell/commander/commander.h index 8c9051a..c2f543a 100644 --- a/src/common/shell/commander/commander.h +++ b/src/common/shell/commander/commander.h @@ -10,11 +10,12 @@ extern "C" { #endif // __cplusplus #define CMD_NO_EXIT(ERR) \ - ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE}) + ((CMDResult){.exited = false, .exit_code = EXIT_FAILURE, .error = ERR}) #define wapp_shell_commander_execute(HANDLE_OUTPUT, OUT_BUF, BUF_SIZE, ...) \ run_command(HANDLE_OUTPUT, OUT_BUF, BUF_SIZE, __VA_ARGS__, NULL) typedef enum { + SHELL_OUTPUT_DISCARD, SHELL_OUTPUT_PRINT, SHELL_OUTPUT_CAPTURE, } CMDOutHandling;