From 1d00a75d2141b79aafdeab360915408da42e1386 Mon Sep 17 00:00:00 2001 From: Jakub Rzeszutko Date: Mon, 9 Aug 2021 16:32:46 +0200 Subject: [PATCH] shell: improve shell_execute_cmd function The function to execute shell commands: shell_execute_cmd will now behave similarly to invoking command line commands. I.e. after the command is executed the command buffer is cleared, while the cursor is set to the initial position. Signed-off-by: Jakub Rzeszutko --- subsys/shell/shell.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/subsys/shell/shell.c b/subsys/shell/shell.c index 791de468883..3c43adb5041 100644 --- a/subsys/shell/shell.c +++ b/subsys/shell/shell.c @@ -1608,6 +1608,8 @@ int shell_execute_cmd(const struct shell *shell, const char *cmd) ret_val = execute(shell); k_mutex_unlock(&shell->ctx->wr_mtx); + cmd_buffer_clear(shell); + return ret_val; }