pty

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ForwardPty

func ForwardPty(dstPty *os.File) (func(), error)

ForwardPty forwards: * terminal input (if any) of the calling process to the dstPty * dstPty terminal output to the calling process terminal * terminal windows size changes from the calling process to the dstPty The function takes ownership of dstPty. This function returns error if none of stdin, stdout, stderr of the calling process is a terminal (PtyNeeded returns false).

func NewPty

func NewPty() (*os.File, *os.File, error)

NewPty creates a new pseduterminal and returns its parent and child file descriptors.

func PtyNeeded

func PtyNeeded() bool

PtyNeeded returns true if any of the stdin, stdout, stderr is a terminal. For descriptors that are terminals, Sandbox needs to create own PTY instead of using the original, not sandboxed terminal.

func ReplaceTerminal

func ReplaceTerminal(ptyToUse *os.File) error

ReplaceTerminal finds which of the stdin, stdout, stderr descriptors point to a terminal, and changes these descriptors to point to the new pseudoterminal ptyToUse.

func SetControllingTerminal

func SetControllingTerminal(pty *os.File) error

SetControllingTerminal sets the pty as the controlling terminal for the current process. The process must be a session leader (call setsid() first).

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL