Merge pull request #157 from mYmNeo/binary-path

let user to specify the shim name or path
This commit is contained in:
Kenfe-Mickaël Laventure 2016-04-21 00:31:14 +10:00
commit b31b8a611e
6 changed files with 21 additions and 9 deletions

View file

@ -17,8 +17,6 @@ import (
ocs "github.com/opencontainers/specs/specs-go"
)
var shimBinary = os.Args[0] + "-shim"
func getRootIDs(s *specs.Spec) (int, int, error) {
if s == nil {
return 0, 0, nil
@ -149,7 +147,7 @@ func (c *container) Start(checkpoint string, s Stdio) (Process, error) {
if err := os.Mkdir(processRoot, 0755); err != nil {
return nil, err
}
cmd := exec.Command(shimBinary,
cmd := exec.Command(c.shim,
c.id, c.bundle, c.runtime,
)
cmd.Dir = processRoot
@ -189,7 +187,7 @@ func (c *container) Exec(pid string, pspec specs.ProcessSpec, s Stdio) (pp Proce
c.RemoveProcess(pid)
}
}()
cmd := exec.Command(shimBinary,
cmd := exec.Command(c.shim,
c.id, c.bundle, c.runtime,
)
cmd.Dir = processRoot
@ -223,7 +221,7 @@ 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("%s not installed on system", shimBinary)
return fmt.Errorf("%s not installed on system", c.shim)
}
}
return err