containerd/add_process.go
Michael Crosby 779cb69e6d Refactor event loop with types
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-12-01 10:55:13 -08:00

21 lines
405 B
Go

package containerd
type AddProcessEvent struct {
s *Supervisor
}
func (h *AddProcessEvent) Handle(e *Event) error {
container, ok := h.s.containers[e.ID]
if !ok {
return ErrContainerNotFound
}
p, err := h.s.runtime.StartProcess(container, *e.Process, e.Stdio)
if err != nil {
return err
}
if e.Pid, err = p.Pid(); err != nil {
return err
}
h.s.processes[e.Pid] = container
return nil
}