gotty/Godeps/_workspace/src/github.com/kr/pty
2015-08-16 20:52:27 +09:00
..
.gitignore Initialize repository 2015-08-16 20:52:27 +09:00
doc.go Initialize repository 2015-08-16 20:52:27 +09:00
ioctl_bsd.go Initialize repository 2015-08-16 20:52:27 +09:00
ioctl.go Initialize repository 2015-08-16 20:52:27 +09:00
License Initialize repository 2015-08-16 20:52:27 +09:00
mktypes.bash Initialize repository 2015-08-16 20:52:27 +09:00
pty_darwin.go Initialize repository 2015-08-16 20:52:27 +09:00
pty_freebsd.go Initialize repository 2015-08-16 20:52:27 +09:00
pty_linux.go Initialize repository 2015-08-16 20:52:27 +09:00
pty_unsupported.go Initialize repository 2015-08-16 20:52:27 +09:00
README.md Initialize repository 2015-08-16 20:52:27 +09:00
run.go Initialize repository 2015-08-16 20:52:27 +09:00
types_freebsd.go Initialize repository 2015-08-16 20:52:27 +09:00
types.go Initialize repository 2015-08-16 20:52:27 +09:00
util.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_386.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_amd64.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_arm64.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_arm.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_freebsd_386.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_freebsd_amd64.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_freebsd_arm.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_ppc64.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_ppc64le.go Initialize repository 2015-08-16 20:52:27 +09:00
ztypes_s390x.go Initialize repository 2015-08-16 20:52:27 +09:00

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