shell: Fix shell_vfprintf when vt100 is disabled

Without this fix, for every call to shell_vfprintf,
a prompt string and vt100 codes are printed too,
resulting in mangled log output.

Signed-off-by: Lars Knudsen <lakd@demant.com>
This commit is contained in:
Lars Knudsen
2023-06-09 10:29:13 +02:00
committed by Anas Nashif
parent 5eb17bca21
commit fb408077df
+2 -2
View File
@@ -1503,11 +1503,11 @@ void shell_vfprintf(const struct shell *sh, enum shell_vt100_color color,
}
k_mutex_lock(&sh->ctx->wr_mtx, K_FOREVER);
if (!z_flag_cmd_ctx_get(sh) && !sh->ctx->bypass) {
if (!z_flag_cmd_ctx_get(sh) && !sh->ctx->bypass && z_flag_use_vt100_get(sh)) {
z_shell_cmd_line_erase(sh);
}
z_shell_vfprintf(sh, color, fmt, args);
if (!z_flag_cmd_ctx_get(sh) && !sh->ctx->bypass) {
if (!z_flag_cmd_ctx_get(sh) && !sh->ctx->bypass && z_flag_use_vt100_get(sh)) {
z_shell_print_prompt_and_cmd(sh);
}
z_transport_buffer_flush(sh);