This is an automated email from the ASF dual-hosted git repository.
masayuki pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 58293ab Follow up task_spawn change from kernel side
58293ab is described below
commit 58293abb8e896bb04f3a76bf8b48206debe68f26
Author: Xiang Xiao <[email protected]>
AuthorDate: Wed May 12 11:47:42 2021 +0800
Follow up task_spawn change from kernel side
Signed-off-by: Xiang Xiao <[email protected]>
---
builtin/exec_builtin.c | 3 ++-
system/popen/popen.c | 12 ++++++++----
system/system/system.c | 8 ++++++--
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/builtin/exec_builtin.c b/builtin/exec_builtin.c
index 7f7b34c..1fc66c5 100644
--- a/builtin/exec_builtin.c
+++ b/builtin/exec_builtin.c
@@ -192,9 +192,10 @@ int exec_builtin(FAR const char *appname, FAR char * const
*argv,
{
/* Start the built-in */
- ret = task_spawn(&pid, builtin->name, builtin->main, &file_actions,
+ pid = task_spawn(builtin->name, builtin->main, &file_actions,
&attr, (argv) ? &argv[1] : (FAR char * const *)NULL,
(FAR char * const *)NULL);
+ ret = pid < 0 ? -pid : 0;
}
if (ret != 0)
diff --git a/system/popen/popen.c b/system/popen/popen.c
index 7f2d797..d9f7757 100644
--- a/system/popen/popen.c
+++ b/system/popen/popen.c
@@ -1,5 +1,5 @@
/****************************************************************************
- * apps/popen/popen/popen.c
+ * apps/system/popen/popen.c
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -253,13 +253,17 @@ FILE *popen(FAR const char *command, FAR const char *mode)
&file_actions, &attr, argv,
(FAR char * const *)NULL);
#else
- errcode = task_spawn(&container->shell, "popen", nsh_system, &file_actions,
- &attr, argv, (FAR char * const *)NULL);
+ container->shell = task_spawn("popen", nsh_system, &file_actions,
+ &attr, argv, (FAR char * const *)NULL);
+ if (container->shell < 0)
+ {
+ errcode = -container->shell;
+ }
#endif
if (errcode != 0)
{
- serr("ERROR: Spawn failed: %d\n", result);
+ serr("ERROR: Spawn failed: %d\n", errcode);
goto errout_with_actions;
}
diff --git a/system/system/system.c b/system/system/system.c
index 8242303..b48e91d 100644
--- a/system/system/system.c
+++ b/system/system/system.c
@@ -136,8 +136,12 @@ int system(FAR const char *cmd)
errcode = posix_spawn(&pid, CONFIG_SYSTEM_SYSTEM_SHPATH, NULL, &attr,
argv, (FAR char * const *)NULL);
#else
- errcode = task_spawn(&pid, "system", nsh_system, NULL, &attr,
- argv, (FAR char * const *)NULL);
+ pid = task_spawn("system", nsh_system, NULL, &attr,
+ argv, (FAR char * const *)NULL);
+ if (pid < 0)
+ {
+ errcode = -pid;
+ }
#endif
/* Release the attributes and check for an error from the spawn operation */