package ptyimport ()// Start assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,// and c.Stderr, calls c.Start, and returns the File of the tty's// corresponding pty.//// Starts the process in a new session and sets the controlling terminal.func ( *exec.Cmd) (*os.File, error) {returnStartWithSize(, nil)}// StartWithAttrs assigns a pseudo-terminal tty os.File to c.Stdin, c.Stdout,// and c.Stderr, calls c.Start, and returns the File of the tty's// corresponding pty.//// This will resize the pty to the specified size before starting the command if a size is provided.// The `attrs` parameter overrides the one set in c.SysProcAttr.//// This should generally not be needed. Used in some edge cases where it is needed to create a pty// without a controlling terminal.func ( *exec.Cmd, *Winsize, *syscall.SysProcAttr) (*os.File, error) { , , := Open()if != nil {returnnil, }deferfunc() { _ = .Close() }() // Best effort.if != nil {if := Setsize(, ); != nil { _ = .Close() // Best effort.returnnil, } }if .Stdout == nil { .Stdout = }if .Stderr == nil { .Stderr = }if .Stdin == nil { .Stdin = } .SysProcAttr = if := .Start(); != nil { _ = .Close() // Best effort.returnnil, }return , }
The pages are generated with Goldsv0.8.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.