Function

Shellutil_spawn_async

Declaration [src]

GPid
shell_util_spawn_async (
  const char* working_directory,
  const char* const* argv,
  const char* const* envp,
  GSpawnFlags flags,
  GError** error
)

Description [src]

A wrapper around g_spawn_async() with async-signal-safe implementation of GSpawnChildSetupFunc to launch a child program asynchronously resetting the rlimit nofile on child setup.

Parameters

working_directory

Type: const char*

Child’s current working directory, or NULL to inherit parent’s.

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

Type: An array of char*

child's argument vector.

The array must be NULL-terminated.
The data is owned by the caller of the function.
Each element is a NUL terminated UTF-8 string.
envp

Type: An array of char*

child's environment, or `NULL` to inherit parent's.

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 NUL terminated UTF-8 string.
flags

Type: GSpawnFlags

Flags from GSpawnFlags.

error

Type: GError **

The return location for a recoverable error.

The argument can be NULL.
If the return location is not NULL, then you must initialize it to a NULL GError*.
The argument will left initialized to NULL by the function if there are no errors.
In case of error, the argument will be set to a newly allocated GError; the caller will take ownership of the data, and be responsible for freeing it.

Return value

Type: GPid

The PID of the child on success, 0 if error is set.