gotty/vendor/github.com/kr/pty
2018-12-27 17:28:06 -08:00
..
.gitignore Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
doc.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ioctl_bsd.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ioctl_solaris.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ioctl.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
License Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
mktypes.bash Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
pty_darwin.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_dragonfly.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_freebsd.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_linux.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_openbsd.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_solaris.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
pty_unsupported.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
README.md Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
run.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
types_dragonfly.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
types_freebsd.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
types_openbsd.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
types.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
util_solaris.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
util.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ztypes_386.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_amd64.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_arm64.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_arm.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_dragonfly_amd64.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ztypes_freebsd_386.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_freebsd_amd64.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_freebsd_arm.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_mipsx.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ztypes_openbsd_386.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ztypes_openbsd_amd64.go updated vendored kr/pty to the current master + Solaris support: 2018-12-27 17:28:06 -08:00
ztypes_ppc64.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_ppc64le.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +09:00
ztypes_s390x.go Change to go1.6.1 and vendoring 2016-04-13 16:17:57 +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)
}