Add specific error message for missing shim

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-03-17 14:04:48 -07:00
parent 797e79774f
commit 366dcc08fa

View file

@ -154,13 +154,9 @@ func (c *container) Start(checkpoint string, s Stdio) (Process, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := cmd.Start(); err != nil { if err := c.startCmd(InitProcessID, cmd, p); err != nil {
return nil, err return nil, err
} }
if err := waitForStart(p, cmd); err != nil {
return nil, err
}
c.processes[InitProcessID] = p
return p, nil return p, nil
} }
@ -198,14 +194,26 @@ func (c *container) Exec(pid string, pspec specs.ProcessSpec, s Stdio) (pp Proce
if err != nil { if err != nil {
return nil, err return nil, err
} }
if err := cmd.Start(); err != nil { if err := c.startCmd(pid, cmd, p); err != nil {
return nil, err return nil, err
} }
return p, nil
}
func (c *container) startCmd(pid string, cmd *exec.Cmd, p *process) error {
if err := cmd.Start(); err != nil {
if exErr, ok := err.(*exec.Error); ok {
if exErr.Err == exec.ErrNotFound || exErr.Err == os.ErrNotExist {
return fmt.Errorf("containerd-shim not installed on system")
}
}
return err
}
if err := waitForStart(p, cmd); err != nil { if err := waitForStart(p, cmd); err != nil {
return nil, err return err
} }
c.processes[pid] = p c.processes[pid] = p
return p, nil return nil
} }
func (c *container) getLibctContainer() (libcontainer.Container, error) { func (c *container) getLibctContainer() (libcontainer.Container, error) {