commit | f4f01f5967533db3c53692bf3b8d9580d798e113 | [log] [tgz] |
---|---|---|
author | Jonathan Logan <JonathanLogan@users.noreply.github.com> | Sat Jan 06 17:34:20 2018 +0000 |
committer | Guillaume J. Charmes <guillaume@charmes.net> | Sat Jan 06 12:34:20 2018 -0500 |
tree | e2bfbaa692f631b8b86456c8ce660f9d251c0c40 | |
parent | 95d05c1eef33a45bd58676b6ce28d105839b8d0b [diff] |
Added terminal/pty resize functionality and utility function to inherit size from master's pty to slave. Changes type winsize to make it accessible from outside the package. (#39)
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) }