shell: Clear command buffer when leaving bypass mode
If bypass mode is left outside of the registered bypass handler, the
command buffer was not cleared, basically containig leftovers from the
processing of the previous command. This resulted in undefined behaviour
on consecutive shell operations.
@@ -1690,6 +1690,10 @@ void shell_set_bypass(const struct shell *sh, shell_bypass_cb_t bypass)
__ASSERT_NO_MSG(sh);
sh->ctx->bypass = bypass;
+
+ if (bypass == NULL) {
+ cmd_buffer_clear(sh);
+ }
}
bool shell_ready(const struct shell *sh)
