Fix monitor with process events

Monitor was receiving multiple events for the process

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-10-06 15:06:34 -07:00
parent 1911191f94
commit a861ae9d18
6 changed files with 172 additions and 84 deletions

View file

@ -83,7 +83,7 @@ func start(log *os.File) error {
}
defer func() {
if err := p.Close(); err != nil {
writeMessage(log, "warn", err)
writeMessage(log, "warn", fmt.Errorf("close stdio %s", err))
}
}()
if err := p.create(); err != nil {
@ -127,7 +127,6 @@ func start(log *os.File) error {
// Wait for all the childs this process may have
// created (needed for exec and init processes when
// they join another pid namespace)
osutils.Reap(true)
p.Wait()
return nil
}
@ -151,7 +150,7 @@ func start(log *os.File) error {
case 2:
// signal
if err := syscall.Kill(p.pid(), syscall.Signal(msg.Width)); err != nil {
writeMessage(log, "warn", err)
writeMessage(log, "warn", fmt.Errorf("signal pid %d: %s", msg.Width, err))
}
}
}