Function

Shellutil_spawn_async_with_pipes

Declaration [src]

GPid
shell_util_spawn_async_with_pipes (
  const char* working_directory,
  const char* const* argv,
  const char* const* envp,
  GSpawnFlags flags,
  int* standard_input,
  int* standard_output,
  int* standard_error,
  GError** error
)

Description [src]

A wrapper around g_spawn_async_with_pipes() 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.

standard_input

Type: int*

Return location for file descriptor to write to child’s stdin, or NULL.

The argument will be set by the function.
The argument can be NULL.
standard_output

Type: int*

Return location for file descriptor to read child’s stdout, or NULL.

The argument will be set by the function.
The argument can be NULL.
standard_error

Type: int*

Return location for file descriptor to read child’s stderr, or NULL.

The argument will be set by the function.
The argument can be NULL.
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.