spawn_command_line_sync
Description:
public bool spawn_command_line_sync (string command_line, out string standard_output = null, out string standard_error = null, out int wait_status = null) throws SpawnError
Example: Spawn a command line, sync:
public static int main (string[] args) {
string ls_stdout;
string ls_stderr;
int ls_status;
try {
Process.spawn_command_line_sync ("ls",
out ls_stdout,
out ls_stderr,
out ls_status);
// Output: <File list>
print ("stdout:\n");
// Output: ````
print (ls_stdout);
print ("stderr:\n");
print (ls_stderr);
// Output: ``0``
print ("Status: %d\n", ls_status);
} catch (SpawnError e) {
print ("Error: %s\n", e.message);
}
return 0;
}
valac --pkg glib-2.0 GLib.Process.spawn_command_line_sync.vala
Namespace: GLib.Process
Package: glib-2.0