mirror of
https://github.com/golang/go
synced 2024-11-25 09:07:58 -07:00
os: change Waitmsg String method to use pointer receiver
Fixes #1851. R=rsc CC=golang-dev https://golang.org/cl/4628045
This commit is contained in:
parent
c2784340a7
commit
cf201ed6a0
@ -123,6 +123,9 @@ func FindProcess(pid int) (p *Process, err Error) {
|
||||
return newProcess(pid, 0), nil
|
||||
}
|
||||
|
||||
func (w Waitmsg) String() string {
|
||||
func (w *Waitmsg) String() string {
|
||||
if w == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
return "exit status: " + w.Msg
|
||||
}
|
||||
|
@ -128,7 +128,10 @@ func itod(i int) string {
|
||||
return string(b[bp:])
|
||||
}
|
||||
|
||||
func (w Waitmsg) String() string {
|
||||
func (w *Waitmsg) String() string {
|
||||
if w == nil {
|
||||
return "<nil>"
|
||||
}
|
||||
// TODO(austin) Use signal names when possible?
|
||||
res := ""
|
||||
switch {
|
||||
|
@ -1042,3 +1042,11 @@ func TestStatDirWithTrailingSlash(t *testing.T) {
|
||||
t.Fatal("stat failed:", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestNilWaitmsgString(t *testing.T) {
|
||||
var w *Waitmsg
|
||||
s := w.String()
|
||||
if s != "<nil>" {
|
||||
t.Errorf("(*Waitmsg)(nil).String() = %q, want %q", s, "<nil>")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user