mirror of https://github.com/xSmurf/oz.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
11 years ago | |
|---|---|---|
| .. | ||
| .gitignore | 11 years ago | |
| License | 11 years ago | |
| README.md | 11 years ago | |
| doc.go | 11 years ago | |
| ioctl.go | 11 years ago | |
| ioctl_bsd.go | 11 years ago | |
| mktypes.bash | 11 years ago | |
| pty_darwin.go | 11 years ago | |
| pty_freebsd.go | 11 years ago | |
| pty_linux.go | 11 years ago | |
| pty_unsupported.go | 11 years ago | |
| run.go | 11 years ago | |
| types.go | 11 years ago | |
| types_freebsd.go | 11 years ago | |
| util.go | 11 years ago | |
| ztypes_386.go | 11 years ago | |
| ztypes_amd64.go | 11 years ago | |
| ztypes_arm.go | 11 years ago | |
| ztypes_arm64.go | 11 years ago | |
| ztypes_freebsd_386.go | 11 years ago | |
| ztypes_freebsd_amd64.go | 11 years ago | |
| ztypes_freebsd_arm.go | 11 years ago | |
| ztypes_ppc64.go | 11 years ago | |
| ztypes_ppc64le.go | 11 years ago | |
| ztypes_s390x.go | 11 years ago | |
README.md
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)
}