Function

Shellutil_spawn_async_with_fds

Declaration [src]

GPid
shell_util_spawn_async_with_fds (
  const char* working_directory,
  const char* const* argv,
  const char* const* envp,
  GSpawnFlags flags,
  int stdin_fd,
  int stdout_fd,
  int stderr_fd,
  GError** error
)

Description [src]

A wrapper around g_spawn_async_with_fds() 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 platform-native string, using the preferred OS encoding on Unix and UTF-8 on Windows.
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.

stdin_fd

Type: int

File descriptor to use for child’s stdin, or -1.

stdout_fd

Type: int

File descriptor to use for child’s stdout, or -1.

stderr_fd

Type: int

File descriptor to use for child’s stderr, or -1.

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 be 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.