xiaoxiang781216 commented on code in PR #1559: URL: https://github.com/apache/nuttx-apps/pull/1559#discussion_r1104766372
########## nshlib/nsh_console.c: ########## @@ -88,21 +84,11 @@ static int nsh_openifnotopen(struct console_stdio_s *pstate) * descriptor may be opened on a different task than the stream. */ - if (!pstate->cn_outstream) - { - pstate->cn_outstream = fdopen(pstate->cn_outfd, "w"); - if (!pstate->cn_outstream) - { - return ERROR; - } - -#if !defined(CONFIG_NSH_ALTCONDEV) - /* If the alternative console is not enabled then stderr = stdout */ +#ifndef CONFIG_NSH_ALTCONDEV + /* If the alternative console is not enabled then stderr = stdout */ - pstate->cn_errfd = pstate->cn_outfd; - pstate->cn_errstream = pstate->cn_outstream; + ERRFD(pstate) = OUTFD(pstate); Review Comment: let's remove nsh_openifnotopen and move the initialization to nsh_newconsole -- 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. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org