Follow up task_spawn change from kernel side

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2021-05-12 11:47:42 +08:00 committed by Masayuki Ishikawa
parent e9104dbbef
commit 58293abb8e
3 changed files with 16 additions and 7 deletions

View File

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

View File

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

View File

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