apps: add variable to identify main shell

Change-Id: Ifecfbb58b3c2cdbeae900eb2eeb2b641155a7580
Signed-off-by: ligd <liguiding1@xiaomi.com>
This commit is contained in:
ligd
2021-06-17 22:59:42 +08:00
committed by David Sidrane
parent 55f921841d
commit faa243844d
9 changed files with 34 additions and 20 deletions

View File

@@ -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