diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-11 12:36:30 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-03-11 12:36:30 +0000 |
commit | c390084bbc63e3c2548734af1b2c53a9a5771729 (patch) | |
tree | 1d665a4ce05d84882e165127198eeb10670a7dd6 /nuttx/examples/nsh/nsh_main.c | |
parent | ee17172d5800fca4fab951e65050b711a6d3b0d4 (diff) | |
download | px4-nuttx-c390084bbc63e3c2548734af1b2c53a9a5771729.tar.gz px4-nuttx-c390084bbc63e3c2548734af1b2c53a9a5771729.tar.bz2 px4-nuttx-c390084bbc63e3c2548734af1b2c53a9a5771729.zip |
apps/-related updates
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3364 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/examples/nsh/nsh_main.c')
-rw-r--r-- | nuttx/examples/nsh/nsh_main.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/nuttx/examples/nsh/nsh_main.c b/nuttx/examples/nsh/nsh_main.c index a13c6dae0..84ef2bdfd 100644 --- a/nuttx/examples/nsh/nsh_main.c +++ b/nuttx/examples/nsh/nsh_main.c @@ -499,23 +499,23 @@ static int nsh_execute(FAR struct nsh_vtbl_s *vtbl, int argc, char *argv[]) if ((ret = exec_nuttapp(cmd, argv)) < 0) { if (errno != ENOENT) - { - return -errno; + { + return -errno; } } else { - /* Is the background mode or foreground mode desired? */ -#if 0 - if (argc > 1 && strcmp(argv[argc-1], "&") == 0) - { - } - else - { - waitpid(ret, ); - } +#ifdef CONFIG_SCHED_WAITPID + if (vtbl->np.np_bg == false) + { + waitpid(ret, NULL, 0); + } + else #endif - return ret; + { + nsh_output(vtbl, "%s [%d:%d]\n", cmd, ret, 128); // \todo get priority from new pid? + return ret; + } } } #endif @@ -1176,6 +1176,7 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) } #endif + /* Check if the output was re-directed using > or >> */ if (argc > 2) @@ -1229,10 +1230,16 @@ int nsh_parse(FAR struct nsh_vtbl_s *vtbl, char *cmdline) nsh_output(vtbl, g_fmttoomanyargs, cmd); } - /* Handle the case where the command is executed in background */ + /* Handle the case where the command is executed in background. + * However is app is to be started as nuttapp new process will + * be created anyway, so skip this step. */ #ifndef CONFIG_EXAMPLES_NSH_DISABLEBG - if (vtbl->np.np_bg) + if (vtbl->np.np_bg +#ifdef CONFIG_EXAMPLES_NSH_BUILTIN_APPS + && nuttapp_isavail(argv[0]) < 0 +#endif + ) { struct sched_param param; struct nsh_vtbl_s *bkgvtbl; |