From a0bcaf4c00163e90133981dff2e1524f2133b170 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 25 Jun 2009 20:24:55 -0700 Subject: Change os.Error convention: echo back context of call in error if likely to be useful. For example, if os.Open("/etc/passwd", os.O_RDONLY) fails with syscall.EPERM, it returns as the os.Error &PathError{ Op: "open", Path: "/etc/passwd" Error: os.EPERM } which formats as open /etc/passwd: permission denied Not converted: datafmt go/... google/... regexp tabwriter template R=r DELTA=1153 (561 added, 156 deleted, 436 changed) OCL=30738 CL=30781 --- src/pkg/exec/exec.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/pkg/exec') diff --git a/src/pkg/exec/exec.go b/src/pkg/exec/exec.go index ebb40a2fe8..7ddb98b508 100644 --- a/src/pkg/exec/exec.go +++ b/src/pkg/exec/exec.go @@ -140,8 +140,8 @@ Error: // other options cause Wait to return for other // process events; see package os for details. func (p *Cmd) Wait(options int) (*os.Waitmsg, os.Error) { - if p.Pid < 0 { - return nil, os.EINVAL; + if p.Pid <= 0 { + return nil, os.ErrorString("exec: invalid use of Cmd.Wait"); } w, err := os.Wait(p.Pid, options); if w != nil && (w.Exited() || w.Signaled()) { @@ -154,7 +154,7 @@ func (p *Cmd) Wait(options int) (*os.Waitmsg, os.Error) { // if it hasn't already, and then closes the non-nil file descriptors // p.Stdin, p.Stdout, and p.Stderr. func (p *Cmd) Close() os.Error { - if p.Pid >= 0 { + if p.Pid > 0 { // Loop on interrupt, but // ignore other errors -- maybe // caller has already waited for pid. -- cgit v1.3