commit | 44e8fe6bc91a1145a342e6c37e1926e66b3ead3b | [log] [tgz] |
---|---|---|
author | Keith Rarick <kr@xph.us> | Thu Apr 05 14:07:33 2012 -0700 |
committer | Keith Rarick <kr@xph.us> | Thu Apr 05 14:07:33 2012 -0700 |
tree | da3f9c31d34a9f7b5406eee3a9395c62698cc72a | |
parent | 411b3baef308176706b2638eaec41c416e093341 [diff] |
add MIT license; closes #2
Pty is a Go package for using unix pseudo-terminals.
(Note, there is only a Linux implementation. I'd appreciate a patch for other systems!)
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) }