diff --git a/nshlib/nsh_builtin.c b/nshlib/nsh_builtin.c index 264979d04..c7a1768d9 100644 --- a/nshlib/nsh_builtin.c +++ b/nshlib/nsh_builtin.c @@ -153,9 +153,14 @@ int nsh_builtin(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, * even if task is still active: If the I/O was re-directed by a * proxy task, then the ask is a child of the proxy, and not this * task. waitpid() fails with ECHILD in either case. + * + * NOTE: WUNTRACED does nothing in the default case, but in the + * case the where CONFIG_SIG_SIGSTOP_ACTION=y, the built-in app + * may also be stopped. In that case WUNTRACED will force + * waitpid() to return with ECHILD. */ - ret = waitpid(ret, &rc, 0); + ret = waitpid(pid, &rc, WUNTRACED); if (ret < 0) { /* If the child thread does not exist, waitpid() will return diff --git a/nshlib/nsh_fileapps.c b/nshlib/nsh_fileapps.c index 4b1bcc3bd..adb99a5e6 100644 --- a/nshlib/nsh_fileapps.c +++ b/nshlib/nsh_fileapps.c @@ -185,9 +185,14 @@ int nsh_fileapp(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, * Here the scheduler will be unlocked while waitpid is waiting * and if the application has not yet run, it will now be able to * do so. + * + * NOTE: WUNTRACED does nothing in the default case, but in the + * case the where CONFIG_SIG_SIGSTOP_ACTION=y, the file app + * may also be stopped. In that case WUNTRACED will force + * waitpid() to return with ECHILD. */ - ret = waitpid(pid, &rc, 0); + ret = waitpid(pid, &rc, WUNTRACED); if (ret < 0) { /* If the child thread does not exist, waitpid() will return