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.
brl ea2034fc45
godep save
10 years ago
..
.gitignore godep save 10 years ago
License godep save 10 years ago
README.md godep save 10 years ago
doc.go godep save 10 years ago
ioctl.go godep save 10 years ago
ioctl_bsd.go godep save 10 years ago
mktypes.bash godep save 10 years ago
pty_darwin.go godep save 10 years ago
pty_freebsd.go godep save 10 years ago
pty_linux.go godep save 10 years ago
pty_unsupported.go godep save 10 years ago
run.go godep save 10 years ago
types.go godep save 10 years ago
types_freebsd.go godep save 10 years ago
util.go godep save 10 years ago
ztypes_386.go godep save 10 years ago
ztypes_amd64.go godep save 10 years ago
ztypes_arm.go godep save 10 years ago
ztypes_arm64.go godep save 10 years ago
ztypes_freebsd_386.go godep save 10 years ago
ztypes_freebsd_amd64.go godep save 10 years ago
ztypes_freebsd_arm.go godep save 10 years ago
ztypes_ppc64.go godep save 10 years ago
ztypes_ppc64le.go godep save 10 years ago
ztypes_s390x.go godep save 10 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)
}