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