Pty.sync


Description:

[ CCode ( has_construct_function = false ) ]
public Pty.sync (PtyFlags flags, Cancellable? cancellable = null) throws Error

Allocates a new pseudo-terminal.

You can later use fork or the spawn_async family of functions to start a process on the PTY.

If using fork, you MUST call child_setup in the child.

If using spawn_async and friends, you MUST either use child_setup directly as the child setup function, or call child_setup from your own child setup function supplied.

When using spawn_sync with a custom child setup function, child_setup will be called before the supplied function; you must not call it again.

Also, you MUST pass the DO_NOT_REAP_CHILD flag.

Note also that STDOUT_TO_DEV_NULL, STDERR_TO_DEV_NULL, and 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 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 SIGWINCH signal. You should prefer using pty_new_sync which does this automatically.

Parameters:

flags

flags from PtyFlags

cancellable

a Cancellable, or null

Returns:

a new Pty, or null on error with error filled in




2022 vala-language.org