nshlib/nsh_console.c: Add fflush to nsh_consolewrite(). This resolves this problem:

> cat /dev/ttyCP &
  > echo ls >/dev/ttyCP

Can't get the 'ls' result immediately, because 'cat' cmd uses nsh_consolewrite() and that uses fwrite with no fflush. We can get the 'ls' result after type '\n', because nsh will fflush output when get '\n'.
This commit is contained in:
ligd 2018-11-07 11:18:03 -06:00 committed by Gregory Nutt
parent 09691dd48f
commit 19dc7cd3b3

View File

@ -186,6 +186,11 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
_err("ERROR: [%d] Failed to send buffer: %d\n",
pstate->cn_outfd, errno);
}
/* Flush the data to the output stream */
fflush(pstate->cn_outstream);
return ret;
#else
/* REVISIT: buffer may not be NUL-terminated */