Files
docker-cli/components/engine/vendor/src/github.com/kr/pty
Tianon Gravi 1ada892daf Bump vendor kr/pty to commit 3b1f6487b (syscall.O_NOCTTY)
Upstream-commit: cb21a4049052a012fd71dcaceef2bb57e1ed36f8
Component: engine
2013-10-01 19:48:50 -06:00
..
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07:00
2013-09-12 20:42:26 -07: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)
}