mirror of
https://github.com/apache/nuttx-apps.git
synced 2025-10-19 02:17:37 +08:00
apps: add variable to identify main shell
Change-Id: Ifecfbb58b3c2cdbeae900eb2eeb2b641155a7580 Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
@@ -155,12 +155,14 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
if (vtbl->np.np_bg == false)
|
||||
# endif /* CONFIG_NSH_DISABLEBG */
|
||||
{
|
||||
/* Setup up to receive SIGINT if control-C entered. The return
|
||||
* value is ignored because this console device may not support
|
||||
* SIGINT.
|
||||
*/
|
||||
int tc = 0;
|
||||
|
||||
ioctl(stdout->fs_fd, TIOCSCTTY, pid);
|
||||
if (vtbl->isctty)
|
||||
{
|
||||
/* Setup up to receive SIGINT if control-C entered. */
|
||||
|
||||
tc = ioctl(stdout->fs_fd, TIOCSCTTY, pid);
|
||||
}
|
||||
|
||||
/* Wait for the application to exit. We did lock the scheduler
|
||||
* above, but that does not guarantee that the application did not
|
||||
@@ -213,7 +215,10 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
|
||||
*/
|
||||
}
|
||||
|
||||
ioctl(stdout->fs_fd, TIOCSCTTY, -1);
|
||||
if (vtbl->isctty && tc == 0)
|
||||
{
|
||||
ioctl(stdout->fs_fd, TIOCNOTTY);
|
||||
}
|
||||
}
|
||||
# ifndef CONFIG_NSH_DISABLEBG
|
||||
else
|
||||
|
Reference in New Issue
Block a user