GLib.spawn_async

function spawn_async(working_directory: String, argv: Array(String), envp: Array(String), flags: GLib.SpawnFlags, child_setup: GLib.SpawnChildSetupFunc): [ok: Boolean, child_pid: GLib.Pid] {
    // Gjs wrapper for g_spawn_async()
}
  

See GLib.spawn_async_with_pipes for a full description; this function simply calls the GLib.spawn_async_with_pipes without any pipes.

You should call GLib.spawn_close_pid on the returned child process reference when you don't need it any more.

If you are writing a GTK+ application, and the program you are spawning is a graphical application, too, then you may want to use gdk_spawn_on_screen() instead to ensure that the spawned program opens its windows on the right screen.

Note that the returned child_pid on Windows is a handle to the child process and not its identifier. Process handles and process identifiers are different concepts on Windows.

working_directory

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

argv

child's argument vector

envp

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

flags

flags from GLib.SpawnFlags

child_setup

function to run in the child just before exec()

ok

true on success, false if error is set

child_pid

return location for child process reference, or null