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. Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
parent
21a7c2d7eb
commit
55af3dd075
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue