xiaoxiang781216 commented on a change in pull request #521: URL: https://github.com/apache/incubator-nuttx-apps/pull/521#discussion_r542368040
########## File path: nshlib/nsh_usbconsole.c ########## @@ -88,15 +88,16 @@ static void nsh_configstdio(int fd, FAR struct console_stdio_s *pstate) dup2(fd, 1); dup2(fd, 2); - /* Setup the stdout */ - - pstate->cn_outfd = 1; - pstate->cn_outstream = fdopen(1, "a"); - - /* Setup the stderr */ + /* fdopen to get the stdin, stdout and stderr streams. + * + * fd = 0 is stdin (read-only) + * fd = 1 is stdout (write-only, append) + * fd = 2 is stderr (write-only, append) + */ - pstate->cn_errfd = 2; - pstate->cn_errstream = fdopen(2, "a"); + fdopen(0, "r"); + fdopen(1, "a"); + fdopen(2, "a"); Review comment: but dev/null or dev/zero may disable too. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org