### Constructor

# Vte Pty new_sync

#### Declaration [src]

    VtePty*
    vte_pty_new_sync (
      VtePtyFlags flags,
      GCancellable* cancellable,
      GError** error
    )

#### Description [src]

Allocates a new pseudo-terminal.

You can later use `fork()` or the `g_spawn_async()` family of functions to start a process on the PTY.

If using fork(), you MUST call `vte_pty_child_setup()` in the child.

If using `g_spawn_async()` and friends, you MUST either use `vte_pty_child_setup()` directly as the child setup function, or call `vte_pty_child_setup()` from your own child setup function supplied.

When using `vte_terminal_spawn_sync()` with a custom child setup function, `vte_pty_child_setup()` will be called before the supplied function; you must not call it again.

Also, you MUST pass the `G_SPAWN_DO_NOT_REAP_CHILD` flag.

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

Note that you should set the PTY’s size using `vte_pty_set_size()` before spawning the child process, so that the child process has the correct size from the start instead of starting with a default size and then shortly afterwards receiving a <literal>SIGWINCH</literal> signal. You should prefer using `vte_terminal_pty_new_sync()` which does this automatically.

#### Parameters

`flags`

  Type: `VtePtyFlags`

  Flags from `VtePtyFlags`.

`cancellable`

  Type: `GCancellable`

  A `GCancellable`, or `NULL`.

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

`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 constructor 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: `VtePty`

A new `VtePty`, or `NULL` on error with `error` filled in.

The caller of the function takes ownership of the data, and is responsible for freeing it.