Merge pull request #187 from nalind/wait
Log more information about exited children
This commit is contained in:
commit
c57530eb47
1 changed files with 15 additions and 3 deletions
|
@ -146,12 +146,24 @@ func StartReaper() {
|
||||||
sig := <-sigs
|
sig := <-sigs
|
||||||
for {
|
for {
|
||||||
// Reap processes
|
// Reap processes
|
||||||
cpid, _ := syscall.Wait4(-1, nil, syscall.WNOHANG, nil)
|
var status syscall.WaitStatus
|
||||||
|
cpid, err := syscall.Wait4(-1, &status, syscall.WNOHANG, nil)
|
||||||
|
if err != nil {
|
||||||
|
if err != syscall.ECHILD {
|
||||||
|
logrus.Debugf("wait4 after %v: %v", sig, err)
|
||||||
|
}
|
||||||
|
break
|
||||||
|
}
|
||||||
if cpid < 1 {
|
if cpid < 1 {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
if status.Exited() {
|
||||||
logrus.Debugf("Reaped process with pid %d %v", cpid, sig)
|
logrus.Debugf("Reaped process with pid %d, exited with status %d", cpid, status.ExitStatus())
|
||||||
|
} else if status.Signaled() {
|
||||||
|
logrus.Debugf("Reaped process with pid %d, exited on %s", cpid, status.Signal())
|
||||||
|
} else {
|
||||||
|
logrus.Debugf("Reaped process with pid %d", cpid)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
Loading…
Reference in a new issue