nsh: return EOF when nread is 0

If enable CONFIG NSH_CLE. When sh reads data and detects that nread is 0,
return EOF and exit.

Signed-off-by: yangsong8 <yangsong8@xiaomi.com>
This commit is contained in:
yangsong8 2024-12-09 21:13:49 +08:00 committed by Xiang Xiao
parent 2bc4bdadee
commit f82e6c2229
2 changed files with 8 additions and 7 deletions

View file

@ -211,11 +211,12 @@ int nsh_session(FAR struct console_stdio_s *pstate,
ret = cle_fd(pstate->cn_line, nsh_prompt(), LINE_MAX,
INFD(pstate), OUTFD(pstate));
if (ret < 0)
if (ret == EOF)
{
dprintf(ERRFD(pstate), g_fmtcmdfailed, "nsh_session",
"cle", NSH_ERRNO_OF(-ret));
continue;
ret = EXIT_SUCCESS;
break;
}
#else
/* Display the prompt string */