Merge pull request #47 from LK4D4/fix_abs_path

Fix absolute path getting for runc binary
This commit is contained in:
Michael Crosby 2015-06-26 17:46:49 -07:00
commit b6c196fd18
2 changed files with 6 additions and 7 deletions

View File

@ -39,6 +39,12 @@ func InitArgs(args ...string) func(*LinuxFactory) error {
if lp, err := exec.LookPath(name); err == nil { if lp, err := exec.LookPath(name); err == nil {
name = lp name = lp
} }
} else {
abs, err := filepath.Abs(name)
if err != nil {
return err
}
name = abs
} }
l.InitPath = name l.InitPath = name
l.InitArgs = append([]string{name}, args[1:]...) l.InitArgs = append([]string{name}, args[1:]...)

View File

@ -2,7 +2,6 @@ package main
import ( import (
"os" "os"
"path/filepath"
"runtime" "runtime"
"github.com/Sirupsen/logrus" "github.com/Sirupsen/logrus"
@ -97,12 +96,6 @@ func main() {
os.Exit(status) os.Exit(status)
} }
//allow for relative path for the runC binary
if absPath, err := filepath.Abs(os.Args[0]); err != nil {
logrus.Fatal("Cannot convert runc path to absolute: %v", err)
} else {
os.Args[0] = absPath
}
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
logrus.Fatal(err) logrus.Fatal(err)
} }