LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 package os | 5 package os |
6 | 6 |
7 import ( | 7 import ( |
8 "runtime" | 8 "runtime" |
9 "syscall" | 9 "syscall" |
10 ) | 10 ) |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 if i < 0 { | 123 if i < 0 { |
124 bp-- | 124 bp-- |
125 b[bp] = '-' | 125 b[bp] = '-' |
126 } | 126 } |
127 | 127 |
128 return string(b[bp:]) | 128 return string(b[bp:]) |
129 } | 129 } |
130 | 130 |
131 func (w *Waitmsg) String() string { | 131 func (w *Waitmsg) String() string { |
| 132 if w == nil { |
| 133 return "<nil>" |
| 134 } |
132 // TODO(austin) Use signal names when possible? | 135 // TODO(austin) Use signal names when possible? |
133 res := "" | 136 res := "" |
134 switch { | 137 switch { |
135 case w.Exited(): | 138 case w.Exited(): |
136 res = "exit status " + itod(w.ExitStatus()) | 139 res = "exit status " + itod(w.ExitStatus()) |
137 case w.Signaled(): | 140 case w.Signaled(): |
138 res = "signal " + itod(w.Signal()) | 141 res = "signal " + itod(w.Signal()) |
139 case w.Stopped(): | 142 case w.Stopped(): |
140 res = "stop signal " + itod(w.StopSignal()) | 143 res = "stop signal " + itod(w.StopSignal()) |
141 if w.StopSignal() == syscall.SIGTRAP && w.TrapCause() != 0 { | 144 if w.StopSignal() == syscall.SIGTRAP && w.TrapCause() != 0 { |
142 res += " (trap " + itod(w.TrapCause()) + ")" | 145 res += " (trap " + itod(w.TrapCause()) + ")" |
143 } | 146 } |
144 case w.Continued(): | 147 case w.Continued(): |
145 res = "continued" | 148 res = "continued" |
146 } | 149 } |
147 if w.CoreDump() { | 150 if w.CoreDump() { |
148 res += " (core dumped)" | 151 res += " (core dumped)" |
149 } | 152 } |
150 return res | 153 return res |
151 } | 154 } |
LEFT | RIGHT |