Merge pull request #1293 from stevenh/resolve-initarg

Resolve InitArgs to ensure init works
This commit is contained in:
Qiang Huang 2017-02-03 19:25:52 +08:00 committed by GitHub
commit be33383e60
1 changed files with 9 additions and 1 deletions

View File

@ -34,7 +34,15 @@ var (
// InitArgs returns an options func to configure a LinuxFactory with the // InitArgs returns an options func to configure a LinuxFactory with the
// provided init binary path and arguments. // provided init binary path and arguments.
func InitArgs(args ...string) func(*LinuxFactory) error { func InitArgs(args ...string) func(*LinuxFactory) error {
return func(l *LinuxFactory) error { return func(l *LinuxFactory) (err error) {
if len(args) > 0 {
// Resolve relative paths to ensure that its available
// after directory changes.
if args[0], err = filepath.Abs(args[0]); err != nil {
return newGenericError(err, ConfigInvalid)
}
}
l.InitArgs = args l.InitArgs = args
return nil return nil
} }