Skip to content

Commit 3f7225a

Browse files
author
lamai93
committed
Get system dependend information.
1 parent f11101a commit 3f7225a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

service/runner_process.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,24 @@ func (p *process) Wait() {
158158
if err != nil {
159159
p.log.Error().Err(err).Msgf("Wait on %d failed", proc.Pid)
160160
} else if ps.ExitCode() != 0 {
161-
p.log.Info().Int("exitcode", ps.ExitCode()).Msgf("Wait on %d returned", proc.Pid)
161+
if ws, ok := ps.Sys().(syscall.WaitStatus); ok {
162+
l := p.log.Info()
163+
if ws.Exited() {
164+
l = l.Int("exit-status", ws.ExitStatus())
165+
}
166+
167+
if ws.Stopped() {
168+
l = l.Str("stop-signal", ws.StopSignal().String())
169+
}
170+
171+
if ws.Signaled() {
172+
l = l.Str("signal", ws.Signal().String())
173+
}
174+
175+
l.Int("trap-cause", ws.TrapCause()).Msgf("Wait on %d returned", proc.Pid)
176+
} else {
177+
p.log.Info().Int("exitcode", ps.ExitCode()).Msgf("Wait on %d returned", proc.Pid)
178+
}
162179
}
163180
} else {
164181
// Cannot wait on non-child process, so let's do it the hard way

0 commit comments

Comments
 (0)