diff --git a/sys/include/shell_lock.h b/sys/include/shell_lock.h index 4b0421ec79..8912be7776 100644 --- a/sys/include/shell_lock.h +++ b/sys/include/shell_lock.h @@ -68,6 +68,11 @@ void shell_lock_checkpoint(char *line_buf, int buf_size); */ bool shell_lock_is_locked(void); +/** + * @brief Lock the shell + */ +void shell_lock_do_lock(void); + #ifdef MODULE_SHELL_LOCK_AUTO_LOCKING /** * @brief Restart the timeout interval before the shell is locked diff --git a/sys/shell/shell.c b/sys/shell/shell.c index 0d82178af8..1045fe775b 100644 --- a/sys/shell/shell.c +++ b/sys/shell/shell.c @@ -501,6 +501,9 @@ void shell_run_once(const shell_command_t *shell_commands, switch (res) { case EOF: + if (IS_USED(MODULE_SHELL_LOCK)) { + shell_lock_do_lock(); + } return; case -ENOBUFS: diff --git a/sys/shell_lock/shell_lock.c b/sys/shell_lock/shell_lock.c index 3b926449a1..2377e205a0 100644 --- a/sys/shell_lock/shell_lock.c +++ b/sys/shell_lock/shell_lock.c @@ -143,10 +143,15 @@ static void _login_barrier(char *line_buf, size_t buf_size) #ifdef MODULE_STDIO_TELNET void telnet_cb_disconneced(void) { - _shell_is_locked = true; + shell_lock_do_lock(); } #endif +void shell_lock_do_lock(void) +{ + _shell_is_locked = true; +} + #ifdef MODULE_SHELL_LOCK_AUTO_LOCKING static void _shell_auto_lock_ztimer_callback(void *arg) {