spawnCommandLineSync

A simple version of glib.global.spawnSync with little-used parameters removed, taking a command line instead of an argument vector.

See glib.global.spawnSync for full details.

The command_line argument will be parsed by glib.global.shellParseArgv.

Unlike glib.global.spawnSync, the G_SPAWN_SEARCH_PATH flag is enabled. Note that G_SPAWN_SEARCH_PATH can have security implications, so consider using glib.global.spawnSync directly if appropriate.

Possible errors are those from glib.global.spawnSync and those from glib.global.shellParseArgv.

If wait_status is non-null, the platform-specific status of the child is stored there; see the documentation of glib.global.spawnCheckWaitStatus for how to use and interpret this. On Unix platforms, note that it is usually not equal to the integer passed to exit() or returned from main().

On Windows, please note the implications of glib.global.shellParseArgv 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'".

bool
spawnCommandLineSync
(,
out string standardOutput
,
out string standardError
,
out int waitStatus
)

Parameters

commandLine string

a command line

standardOutput string

return location for child output

standardError string

return location for child errors

waitStatus int

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

Return Value

Type: bool

true on success, false if an error was set