Move supervisor to it's own package
It allows to keep main namespace cleaner Signed-off-by: Alexander Morozov <lk4d4@docker.com>
This commit is contained in:
parent
b296d50493
commit
69f8f566a2
24 changed files with 61 additions and 59 deletions
22
supervisor/signal.go
Normal file
22
supervisor/signal.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package supervisor
|
||||
|
||||
type SignalEvent struct {
|
||||
s *Supervisor
|
||||
}
|
||||
|
||||
func (h *SignalEvent) Handle(e *Event) error {
|
||||
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 pid, err := p.Pid(); err == nil && pid == e.Pid {
|
||||
return p.Signal(e.Signal)
|
||||
}
|
||||
}
|
||||
return ErrProcessNotFound
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue