os: change Waitmsg String method to use pointer receiver

Fixes #1851.

R=rsc
CC=golang-dev
https://golang.org/cl/4628045
diff --git a/src/pkg/os/exec_plan9.go b/src/pkg/os/exec_plan9.go
index 0598adc..2590dd6 100644
--- a/src/pkg/os/exec_plan9.go
+++ b/src/pkg/os/exec_plan9.go
@@ -123,6 +123,9 @@
 	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
 }
diff --git a/src/pkg/os/exec_posix.go b/src/pkg/os/exec_posix.go
index 734bf88..7dfcdd4 100644
--- a/src/pkg/os/exec_posix.go
+++ b/src/pkg/os/exec_posix.go
@@ -128,7 +128,10 @@
 	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 {
diff --git a/src/pkg/os/os_test.go b/src/pkg/os/os_test.go
index e442e7c..c22b536 100644
--- a/src/pkg/os/os_test.go
+++ b/src/pkg/os/os_test.go
@@ -1042,3 +1042,11 @@
 		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>")
+	}
+}