Clone this repo:
  1. 2c10821 Add mips64 mips64le build tags (#47) by Guillaume J. Charmes · 2 weeks ago master v1.0.0
  2. 54a2d19 Add support for mips, mipsle (#45) by vstefanovic · 2 weeks ago
  3. ce7fa45 Merge pull request #44 from cmarcelo/pr/dragonfly-gofmt by Guillaume J. Charmes · 8 months ago
  4. ed84cf8 Reformat pty_dragonfly.go file using gofmt by Caio Marcelo de Oliveira Filho · 8 months ago
  5. a6bad5e Merge pull request #36 from keybase/master by Guillaume J. Charmes · 9 months ago

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