function spawn_sync(working_directory: String, argv: Array(String), envp: Array(String), flags: GLib.SpawnFlags, child_setup: GLib.SpawnChildSetupFunc): [ok: Boolean, standard_output: ByteArray, standard_error: ByteArray, exit_status: Number(gint)] {
    // Gjs wrapper for g_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 GLib.SpawnFlags.stdout_to_dev_null and GLib.SpawnFlags.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 GLib.spawn_check_exit_status for how to use and interpret this. Note that it is invalid to pass GLib.SpawnFlags.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 GLib.spawn_async_with_pipes internally; see that function for full details on the other parameters and details on how these functions work on Windows.


child's current working directory, or null to inherit parent's


child's argument vector


child's environment, or null to inherit parent's


flags from GLib.SpawnFlags


function to run in the child just before exec()


true on success, false if an error was set


return location for child output, or null


return location for child error messages, or null


return location for child exit status, as returned by waitpid(), or null