Terminal.spawnAsync

A convenience function that wraps creating the #VtePty and spawning the child process on it. See vte_pty_new_sync(), vte_pty_spawn_async(), and vte_pty_spawn_finish() for more information.

When the operation is finished successfully, @callback will be called with the child #GPid, and a %NULL #GError. The child PID will already be watched via vte_terminal_watch_child().

When the operation fails, @callback will be called with a -1 #GPid, and a non-%NULL #GError containing the error information.

Note that if @terminal has been destroyed before the operation is called, @callback will be called with a %NULL @terminal; you must not do anything in the callback besides freeing any resources associated with @user_data, but taking care not to access the now-destroyed #VteTerminal. Note that in this case, if spawning was successful, the child process will be aborted automatically.

Beginning with 0.52, sets PWD to @working_directory in order to preserve symlink components. The caller should also make sure that symlinks were preserved while constructing the value of @working_directory, e.g. by using vte_terminal_get_current_directory_uri(), g_get_current_dir() or get_current_dir_name().

Parameters

ptyFlags VtePtyFlags

flags from #VtePtyFlags

workingDirectory string

the name of a directory the command should start in, or %NULL to use the current working directory

argv string[]

child's argument vector

envv string[]

a list of environment variables to be added to the environment before starting the process, or %NULL

spawnFlags GSpawnFlags

flags from #GSpawnFlags

childSetup GSpawnChildSetupFunc

an extra child setup function to run in the child just before exec(), or %NULL

childSetupData void*

user data for @child_setup, or %NULL

childSetupDataDestroy GDestroyNotify

a #GDestroyNotify for @child_setup_data, or %NULL

timeout int

a timeout value in ms, or -1 to wait indefinitely

cancellable Cancellable

a #GCancellable, or %NULL

callback VteTerminalSpawnAsyncCallback

a #VteTerminalSpawnAsyncCallback, or %NULL

userData void*

user data for @callback, or %NULL

Meta

Since

0.48