diff options
| author | Russ Cox <rsc@golang.org> | 2009-06-25 20:24:55 -0700 |
|---|---|---|
| committer | Russ Cox <rsc@golang.org> | 2009-06-25 20:24:55 -0700 |
| commit | a0bcaf4c00163e90133981dff2e1524f2133b170 (patch) | |
| tree | 1596fd2f89c1d896cdf5772aebc910f4e0ff5bda /src/pkg/exec/exec.go | |
| parent | 70e232e668e459c9f730a2213f8270660b36558b (diff) | |
| download | go-a0bcaf4c00163e90133981dff2e1524f2133b170.tar.xz | |
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
Diffstat (limited to 'src/pkg/exec/exec.go')
| -rw-r--r-- | src/pkg/exec/exec.go | 6 |
1 files changed, 3 insertions, 3 deletions
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. |
