wide/vendor/github.com/kr/pty
Liang Ding 0b8da63175 Update vendor 2018-03-13 13:11:10 +08:00
..
License Update vendor 2018-03-13 13:11:10 +08:00
README.md Update vendor 2018-03-13 13:11:10 +08:00
doc.go Update vendor 2018-03-13 13:11:10 +08:00
ioctl.go Update vendor 2018-03-13 13:11:10 +08:00
ioctl_bsd.go Update vendor 2018-03-13 13:11:10 +08:00
mktypes.bash Update vendor 2018-03-13 13:11:10 +08:00
pty_darwin.go Update vendor 2018-03-13 13:11:10 +08:00
pty_dragonfly.go Update vendor 2018-03-13 13:11:10 +08:00
pty_freebsd.go Update vendor 2018-03-13 13:11:10 +08:00
pty_linux.go Update vendor 2018-03-13 13:11:10 +08:00
pty_unsupported.go Update vendor 2018-03-13 13:11:10 +08:00
run.go Update vendor 2018-03-13 13:11:10 +08:00
util.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_386.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_amd64.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_arm.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_arm64.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_dragonfly_amd64.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_freebsd_386.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_freebsd_amd64.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_freebsd_arm.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_mipsx.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_ppc64.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_ppc64le.go Update vendor 2018-03-13 13:11:10 +08:00
ztypes_s390x.go Update vendor 2018-03-13 13:11:10 +08:00

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)
}