Spawn.sync

Executes a child synchronously (waits for the child to exit before returning). All output from the child is stored in standard_output and standard_error, if those parameters are non-NULL. Note that you must set the G_SPAWN_STDOUT_TO_DEV_NULL and G_SPAWN_STDERR_TO_DEV_NULL flags when passing NULL for standard_output and standard_error. If exit_status is non-NULL, the platform-specific exit status of the child is stored there; see the documentation of g_spawn_check_exit_status() for how to use and interpret this. Note that it is invalid to pass G_SPAWN_DO_NOT_REAP_CHILD in flags. If an error occurs, no data is returned in standard_output, standard_error, or exit_status. This function calls g_spawn_async_with_pipes() internally; see that function for full details on the other parameters and details on how these functions work on Windows.

class Spawn
static
int
sync

Parameters

workingDirectory string

child's current working directory, or NULL to inherit parent's. [allow-none]

argv string[]

child's argument vector. [array zero-terminated=1]

envp string[]

child's environment, or NULL to inherit parent's. [array zero-terminated=1][allow-none]

flags GSpawnFlags

flags from GSpawnFlags

childSetup GSpawnChildSetupFunc

function to run in the child just before exec(). [scope async][allow-none]

userData void*

user data for child_setup. closure

standardOutput string

return location for child output, or NULL. out[array zero-terminated=1][element-type guint8][allow-none]

standardError string

return location for child error messages, or NULL. out[array zero-terminated=1][element-type guint8][allow-none]

exitStatus int

return location for child exit status, as returned by waitpid(), or NULL. out[allow-none]

Return Value

Type: int

TRUE on success, FALSE if an error was set.

Meta