From 30f818a2e371d7c281203de728cd2aed778471ea Mon Sep 17 00:00:00 2001 From: openshwprojects Date: Sat, 18 Feb 2023 15:08:39 +0100 Subject: [PATCH] Web App will always now print automatically command result, because few commands missed confirmation and were confusing users --- src/cmnds/cmd_public.h | 2 ++ src/httpserver/rest_interface.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cmnds/cmd_public.h b/src/cmnds/cmd_public.h index e6e2e0b0f..4948658ca 100644 --- a/src/cmnds/cmd_public.h +++ b/src/cmnds/cmd_public.h @@ -225,6 +225,8 @@ void CMD_StartTCPCommandLine(); // cmd_script.c int CMD_GetCountActiveScriptThreads(); +const char *CMD_GetResultString(commandResult_t r); + void SVM_RunThreads(int deltaMS); void CMD_InitScripting(); byte* LFS_ReadFile(const char* fname); diff --git a/src/httpserver/rest_interface.c b/src/httpserver/rest_interface.c index 9e0894757..ebd800787 100644 --- a/src/httpserver/rest_interface.c +++ b/src/httpserver/rest_interface.c @@ -1563,8 +1563,12 @@ static int http_rest_post_channels(http_request_t* request) { static int http_rest_post_cmd(http_request_t* request) { - char* cmd = request->bodystart; - CMD_ExecuteCommand(cmd, COMMAND_FLAG_SOURCE_CONSOLE); + commandResult_t res; + const char* cmd = request->bodystart; + res = CMD_ExecuteCommand(cmd, COMMAND_FLAG_SOURCE_CONSOLE); + if (1) { + addLogAdv(LOG_INFO, LOG_FEATURE_CMD, "[WebApp Cmd '%s' Result] %s", cmd, CMD_GetResultString(res)); + } return http_rest_error(request, 200, "OK"); }