Pty.newSync

Allocates a new pseudo-terminal.

You can later use fork() or the glib.global.spawnAsync family of functions to start a process on the PTY.

If using fork(), you MUST call vte.pty.Pty.childSetup in the child.

If using glib.global.spawnAsync and friends, you MUST either use vte.pty.Pty.childSetup directly as the child setup function, or call vte.pty.Pty.childSetup from your own child setup function supplied.

When using vte.terminal.Terminal.spawnSync with a custom child setup function, vte.pty.Pty.childSetup 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.Pty.setSize 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.Terminal.ptyNewSync which does this automatically.

Parameters

flags vte.types.PtyFlags

flags from #VtePtyFlags

cancellable gio.cancellable.Cancellable

a #GCancellable, or null

Return Value

Type: vte.pty.Pty

a new #VtePty, or null on error with error filled in