Vte.Terminal.spawn_sync

### Method

# Vte Terminalspawn_sync

deprecated: 0.48

#### Declaration [src]

    gboolean
    vte_terminal_spawn_sync (
      VteTerminal* terminal,
      VtePtyFlags pty_flags,
      const char* working_directory,
      char** argv,
      char** envv,
      GSpawnFlags spawn_flags,
      GSpawnChildSetupFunc child_setup,
      gpointer child_setup_data,
      GPid* child_pid,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Starts the specified command under a newly-allocated controlling pseudo-terminal. The `argv` and `envv` lists should be `NULL`-terminated. The “TERM” environment variable is automatically set to a default value, but can be overridden from `envv`. `pty_flags` controls logging the session to the specified system log files.

Note that `G_SPAWN_DO_NOT_REAP_CHILD` will always be added to `spawn_flags`.

Note also that `G_SPAWN_STDOUT_TO_DEV_NULL`, `G_SPAWN_STDERR_TO_DEV_NULL`, and `G_SPAWN_CHILD_INHERITS_STDIN` are not supported in `spawn_flags`, since stdin, stdout and stderr of the child process will always be connected to the PTY.

Note that all open file descriptors will be closed in the child. If you want to keep some file descriptor open for use in the child process, you need to use a child setup function that unsets the FD_CLOEXEC flag on that file descriptor.

See vte_pty_new(), `g_spawn_async()` and `vte_terminal_watch_child()` for more information.

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().

Deprecated since: 0.48

Use `vte_terminal_spawn_async()` instead.

#### Parameters

`pty_flags`

  Type: `VtePtyFlags`

  Flags from `VtePtyFlags`.

`working_directory`

  Type: `const char*`

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

  The argument can be `NULL`.
  The data is owned by the caller of the method.
  The value is a NUL terminated UTF-8 string.

`argv`

  Type: An array of `filename`

  Child’s argument vector.

  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a file system path, using the OS encoding.

`envv`

  Type: An array of `filename`

  A list of environment variables to be added to the environment before starting the process, or `NULL`.

  The argument can be `NULL`.
  The array must be `NULL`-terminated.
  The data is owned by the caller of the method.
  Each element is a file system path, using the OS encoding.

`spawn_flags`

  Type: `GSpawnFlags`

  Flags from `GSpawnFlags`.

`child_setup`

  Type: `GSpawnChildSetupFunc`

  An extra child setup function to run in the child just before exec(), or `NULL`.

  The argument can be `NULL`.

`child_setup_data`

  Type: `gpointer`

  User data for `child_setup`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`child_pid`

  Type: `GPid`

  A location to store the child PID, or `NULL`.

  The argument will be set by the function.
  The argument can be `NULL`.
  The caller of the method takes ownership of the data, and is responsible for freeing it.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `gboolean`

`TRUE` on success, or `FALSE` on error with `error` filled in.