package
Version:
v1.2.1
Opens a new window with list of versions in this module.
Published: Jul 14, 2016
License: MIT, Apache-2.0
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
pty
Pty is a Go package for using unix pseudo-terminals.
Install
go get github.com/kr/pty
Example
package main
import (
"github.com/kr/pty"
"io"
"os"
"os/exec"
)
func main() {
c := exec.Command("grep", "--color=auto", "bar")
f, err := pty.Start(c)
if err != nil {
panic(err)
}
go func() {
f.Write([]byte("foo\n"))
f.Write([]byte("bar\n"))
f.Write([]byte("baz\n"))
f.Write([]byte{4}) // EOT
}()
io.Copy(os.Stdout, f)
}
Documentation
¶
Package pty provides functions for working with Unix terminals.
View Source
var ErrUnsupported = errors.New("unsupported")
ErrUnsupported is returned if a function is not
available on the current platform.
Getsize returns the number of rows (lines) and cols (positions
in each line) in terminal t.
Opens a pty and its corresponding tty.
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.
Source Files
¶
- doc.go
- ioctl.go
- pty_linux.go
- run.go
- util.go
- ztypes_amd64.go
Click to show internal directories.
Click to hide internal directories.