Function
GLibspawn_async
Declaration [src]
gboolean
g_spawn_async(
constgchar*working_directory,
gchar**argv,
gchar**envp,
GSpawnFlagsflags,
GSpawnChildSetupFuncchild_setup,
gpointeruser_data,
GPid*child_pid,
GError**error
)
Description [src]
Executes a child program asynchronously.
See g_spawn_async_with_pipes_and_fds() for a full description; this function
simply calls the g_spawn_async_with_pipes() without any pipes, which in turn
calls g_spawn_async_with_pipes_and_fds().
You should call g_spawn_close_pid() on the returned child process
reference when you don’t need it any more.
If you are writing a GTK application, and the program you are spawning is a
graphical application too, then to ensure that the spawned program opens its
windows on the right screen, you may want to use GdkAppLaunchContext,
GAppLaunchContext, or set the DISPLAY environment variable.
Note that the returned child_pid on Windows is a handle to the child
process and not its identifier. Process handles and process identifiers
are different concepts on Windows.
Parameters
working_directory-
Type:
const gchar*Child’s current working directory, or
NULLto inherit parent’s.The argument can beNULL.The data is owned by the caller of the function.The value is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows. argv-
Type: An array of
filenamechild's argument vector.The array must beNULL-terminated.The data is owned by the caller of the function.Each element is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows. envp-
Type: An array of
filenamechild's environment, or `NULL` to inherit parent's.The argument can beNULL.The array must beNULL-terminated.The data is owned by the caller of the function.Each element is a platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows. flags-
Type:
GSpawnFlagsFlags from
GSpawnFlags. child_setup-
Type:
GSpawnChildSetupFuncFunction to run in the child just before
exec().The argument can beNULL. user_data-
Type:
gpointerUser data for
child_setup.The argument can beNULL.The data is owned by the caller of the function. child_pid-
Type:
GPidReturn location for child process reference, or
NULL.The argument will be set by the function.The argument can beNULL.The caller of the function takes ownership of the returned data, and is responsible for freeing it. error-
Type:
The return location for a recoverable error.
The argument can beNULL.If the return location is notNULL, then you must initialize it to aNULLGError*.The argument will be left initialized toNULLby the function if there are no errors.In case of error, the argument will be set to a newly allocatedGError; the caller will take ownership of the data, and be responsible for freeing it.
Return value
Type: gboolean
TRUE on success, FALSE if error is set.