commit | c0bea8ed3c8ff9ecb23c54be9b82ed24a3501420 | [log] [tgz] |
---|---|---|
author | Michael Neumann <mneumann@ntecs.de> | Fri May 20 15:25:14 2016 +0200 |
committer | Michael Neumann <mneumann@ntecs.de> | Fri May 20 15:25:14 2016 +0200 |
tree | fc26a677f884743a07533ccd6fa2615c83c0aecf | |
parent | f7ee69f31298ecbe5d2b349c711e2547a617d398 [diff] |
Support DragonFly BSD Tested with "go test" of github.com/creack/termios.
Pty is a Go package for using unix pseudo-terminals.
go get github.com/kr/pty
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) }