Commit 5d198bf8 authored by Brad Fitzpatrick's avatar Brad Fitzpatrick

os/exec: add Cmd.Waitmsg, fix a misleading comment

Fixes #2948

R=golang-dev, r
CC=golang-dev
https://golang.org/cl/5655048
parent 4c769512
...@@ -68,7 +68,7 @@ type Cmd struct { ...@@ -68,7 +68,7 @@ type Cmd struct {
// new process. It does not include standard input, standard output, or // new process. It does not include standard input, standard output, or
// standard error. If non-nil, entry i becomes file descriptor 3+i. // standard error. If non-nil, entry i becomes file descriptor 3+i.
// //
// BUG: on OS X 10.6, child processes may sometimes inherit extra fds. // BUG: on OS X 10.6, child processes may sometimes inherit unwanted fds.
// http://golang.org/issue/2603 // http://golang.org/issue/2603
ExtraFiles []*os.File ExtraFiles []*os.File
...@@ -79,6 +79,10 @@ type Cmd struct { ...@@ -79,6 +79,10 @@ type Cmd struct {
// Process is the underlying process, once started. // Process is the underlying process, once started.
Process *os.Process Process *os.Process
// Waitmsg contains information about an exited process,
// available after a call to Wait or Run.
Waitmsg *os.Waitmsg
err error // last error (from LookPath, stdin, stdout, stderr) err error // last error (from LookPath, stdin, stdout, stderr)
finished bool // when Wait was called finished bool // when Wait was called
childFiles []*os.File childFiles []*os.File
...@@ -288,6 +292,7 @@ func (c *Cmd) Wait() error { ...@@ -288,6 +292,7 @@ func (c *Cmd) Wait() error {
} }
c.finished = true c.finished = true
msg, err := c.Process.Wait(0) msg, err := c.Process.Wait(0)
c.Waitmsg = msg
var copyError error var copyError error
for _ = range c.goroutine { for _ = range c.goroutine {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment