aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/os/exec
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2012-02-21 14:10:34 +1100
committerRob Pike <r@golang.org>2012-02-21 14:10:34 +1100
commitccacab641af54f51bdca228445f464efde47e935 (patch)
tree03e67f8e0688d1d4e1d72d1a26e00849764f6544 /src/pkg/os/exec
parent22c41ff019592edcc7f7039d1ac0fffd638c4b7b (diff)
downloadgo-ccacab641af54f51bdca228445f464efde47e935.tar.xz
os: replace non-portable Waitmsg with portable ProcessState
Use methods for key questions. Provide access to non-portable pieces through portable methods. Windows and Plan 9 updated. R=golang-dev, bradfitz, bradfitz, r, dsymonds, rsc, iant, iant CC=golang-dev https://golang.org/cl/5673077
Diffstat (limited to 'src/pkg/os/exec')
-rw-r--r--src/pkg/os/exec/exec.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/pkg/os/exec/exec.go b/src/pkg/os/exec/exec.go
index 248d97d458..ebe92a9fba 100644
--- a/src/pkg/os/exec/exec.go
+++ b/src/pkg/os/exec/exec.go
@@ -79,9 +79,9 @@ type Cmd struct {
// Process is the underlying process, once started.
Process *os.Process
- // Waitmsg contains information about an exited process,
+ // ProcessState contains information about an exited process,
// available after a call to Wait or Run.
- Waitmsg *os.Waitmsg
+ ProcessState *os.ProcessState
err error // last error (from LookPath, stdin, stdout, stderr)
finished bool // when Wait was called
@@ -266,11 +266,11 @@ func (c *Cmd) Start() error {
// An ExitError reports an unsuccessful exit by a command.
type ExitError struct {
- *os.Waitmsg
+ *os.ProcessState
}
func (e *ExitError) Error() string {
- return e.Waitmsg.String()
+ return e.ProcessState.String()
}
// Wait waits for the command to exit.
@@ -291,8 +291,8 @@ func (c *Cmd) Wait() error {
return errors.New("exec: Wait was already called")
}
c.finished = true
- msg, err := c.Process.Wait()
- c.Waitmsg = msg
+ state, err := c.Process.Wait()
+ c.ProcessState = state
var copyError error
for _ = range c.goroutine {
@@ -307,8 +307,8 @@ func (c *Cmd) Wait() error {
if err != nil {
return err
- } else if !msg.Exited() || msg.ExitStatus() != 0 {
- return &ExitError{msg}
+ } else if !state.Success() {
+ return &ExitError{state}
}
return copyError