Merge pull request #47 from LK4D4/fix_abs_path
Fix absolute path getting for runc binary
This commit is contained in:
commit
b6c196fd18
|
@ -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:]...)
|
||||||
|
|
7
main.go
7
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue