Jonathan Boulle f7ee69f312 run: don't override supplied SysProcAttr
If we're passed an exec.Cmd that already has a configured SysProcAttr,
Start was obliterating it by overwriting it with a new struct in order
to set `Setctty` and `Setsid`. Instead, just adjust the parameters that
we need.
2015-10-07 16:04:24 -07:00
2014-03-14 17:28:51 +02:00
2014-03-14 17:28:51 +02:00
2014-03-14 17:28:51 +02:00
2014-12-04 22:21:03 +09:00
2014-03-14 17:28:51 +02:00
2014-03-14 17:28:51 +02:00
2013-03-16 18:25:38 -07:00
2014-03-14 17:28:51 +02:00
2014-03-14 17:28:51 +02:00

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)
}
Description
PTY interface for Go
Readme MIT 397 KiB
Languages
Go 93.4%
Shell 5.6%
Assembly 1%