GLib.spawn_command_line_sync

function spawn_command_line_sync(command_line: String): [ok: Boolean, standard_output: ByteArray, standard_error: ByteArray, exit_status: Number(gint)] {
    // Gjs wrapper for g_spawn_command_line_sync()
}
  

A simple version of GLib.spawn_sync with little-used parameters removed, taking a command line instead of an argument vector. See GLib.spawn_sync for full details. command_line will be parsed by GLib.shell_parse_argv. Unlike GLib.spawn_sync, the GLib.SpawnFlags.search_path flag is enabled. Note that GLib.SpawnFlags.search_path can have security implications, so consider using GLib.spawn_sync directly if appropriate. Possible errors are those from GLib.spawn_sync and those from GLib.shell_parse_argv.

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.

On Windows, please note the implications of GLib.shell_parse_argv parsing command_line. Parsing is done according to Unix shell rules, not Windows command interpreter rules. Space is a separator, and backslashes are special. Thus you cannot simply pass a command_line containing canonical Windows paths, like "c:\\program files\\app\\app.exe", as the backslashes will be eaten, and the space will act as a separator. You need to enclose such paths with single quotes, like "'c:\\program files\\app\\app.exe' 'e:\\folder\\argument.txt'".

command_line

a command line

ok

true on success, false if an error was set

standard_output

return location for child output

standard_error

return location for child errors

exit_status

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