Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // add this code to $GOROOT/src/pkg/os/exec/exec.go
- // then rebuild golang
- // cd $GOROOT/src && ./make.bash
- func (c *Cmd) Output3() ([]byte, []byte, error) {
- if c.Stdout != nil || c.Stderr != nil {
- return nil, nil, errors.New("exec: Stdout or Stderr already set")
- }
- var o bytes.Buffer
- var e bytes.Buffer
- c.Stdout = &o
- c.Stderr = &e
- err := c.Run()
- return o.Bytes(), e.Bytes(), err
- }
Add Comment
Please, Sign In to add comment