| commit | 227762de521220439e12273211db1f7b5d90cd79 | [log] [tgz] |
|---|---|---|
| author | Keith Rarick <kr@xph.us> | Tue May 24 19:08:43 2011 |
| committer | Keith Rarick <kr@xph.us> | Tue May 24 19:08:43 2011 |
| tree | 0d97a9a13678c5b8a35b928efb4b9cdc2b21f469 | |
| parent | e4a07d18913077aaf31c2dbb811e957a063708d2 [diff] |
gofix for release.r57.1
Pty is a Go package for using unix pseudo-terminals.
(Note, the Darwin implementation doesn‘t work. If you are interested in fixing it, I’d appreciate a patch!)
goinstall github.com/kr/pty
package main
import (
"fmt"
"github.com/kr/pty"
"io"
"os"
)
func main() {
c, err := pty.Run(
"/bin/grep",
[]string{"grep", "--color=auto", "bar"},
nil,
"",
)
if err != nil {
panic(err)
}
go func() {
fmt.Fprintln(c.Stdin, "foo")
fmt.Fprintln(c.Stdin, "bar")
fmt.Fprintln(c.Stdin, "baz")
c.Stdin.Close()
}()
io.Copy(os.Stdout, c.Stdout)
c.Wait(0)
}