Skip to content

Commit 035199e

Browse files
authored
Merge pull request #224 from arangodb-helper/feature/exitcode-process
Exit code
2 parents d2baf06 + 4fe1bbd commit 035199e

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

service/runner_process.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,32 @@ 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+
if ws.Continued() {
176+
l = l.Bool("continued", true)
177+
}
178+
179+
if ws.CoreDump() {
180+
l = l.Bool("core-dump", true)
181+
}
182+
183+
l.Int("trap-cause", ws.TrapCause()).Msgf("Wait on %d returned", proc.Pid)
184+
} else {
185+
p.log.Info().Int("exitcode", ps.ExitCode()).Msgf("Wait on %d returned", proc.Pid)
186+
}
162187
}
163188
} else {
164189
// Cannot wait on non-child process, so let's do it the hard way

0 commit comments

Comments
 (0)