Function
GLibspawn_async
Declaration
gboolean
g_spawn_async (
const gchar* working_directory,
gchar** argv,
gchar** envp,
GSpawnFlags flags,
GSpawnChildSetupFunc child_setup,
gpointer user_data,
GPid* child_pid,
GError** error
)
Description
Executes a child program asynchronously.
See g_spawn_async_with_pipes()
for a full description; this function
simply calls the g_spawn_async_with_pipes()
without any pipes.
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 |
const gchar* |
Child’s current working
directory, or |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
The value is a file system path, using the OS encoding. | |
argv |
An array of filename |
|
|
The array must be NULL -terminated. | |
The data is owned by the caller of the function. | |
Each element is a file system path, using the OS encoding. | |
envp |
An array of filename |
|
|
The argument can be NULL . | |
The array must be NULL -terminated. | |
The data is owned by the caller of the function. | |
Each element is a file system path, using the OS encoding. | |
flags |
GSpawnFlags |
Flags from |
|
child_setup |
GSpawnChildSetupFunc |
Function to run in the child just before |
|
The argument can be NULL . | |
user_data |
gpointer |
User data for |
|
The argument can be NULL . | |
The data is owned by the caller of the function. | |
child_pid |
GPid |
Return location for child process reference, or |
|
The argument will be set by the function. | |
The argument can be NULL . | |
The called function takes ownership of the data, and is responsible for freeing it. | |
error |
GError ** |
The return location for a GError* , or NULL . |