2015-12-18 00:07:04 +00:00
|
|
|
package supervisor
|
2015-12-01 18:55:13 +00:00
|
|
|
|
|
|
|
type SignalEvent struct {
|
|
|
|
s *Supervisor
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *SignalEvent) Handle(e *Event) error {
|
2016-02-01 19:02:41 +00:00
|
|
|
i, ok := h.s.containers[e.ID]
|
|
|
|
if !ok {
|
|
|
|
return ErrContainerNotFound
|
|
|
|
}
|
|
|
|
processes, err := i.container.Processes()
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
for _, p := range processes {
|
|
|
|
if p.ID() == e.Pid {
|
|
|
|
return p.Signal(e.Signal)
|
2015-12-01 18:55:13 +00:00
|
|
|
}
|
2016-02-01 19:02:41 +00:00
|
|
|
}
|
2015-12-01 18:55:13 +00:00
|
|
|
return ErrProcessNotFound
|
|
|
|
}
|