diff --git a/command/meta.go b/command/meta.go index 25d36a05e..c84f7550e 100644 --- a/command/meta.go +++ b/command/meta.go @@ -382,6 +382,18 @@ func (m *Meta) process(args []string, vars bool) ([]string, error) { // the args... m.autoKey = "" if vars { + var preArgs []string + + if _, err := os.Stat(DefaultVarsFilename); err == nil { + m.autoKey = "var-file-default" + preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename) + } + + if _, err := os.Stat(DefaultVarsFilename + ".json"); err == nil { + m.autoKey = "var-file-default" + preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename+".json") + } + wd, err := os.Getwd() if err != nil { return nil, err @@ -400,18 +412,6 @@ func (m *Meta) process(args []string, vars bool) ([]string, error) { return nil, err } - var preArgs []string - - if _, err = os.Stat(DefaultVarsFilename); err == nil { - m.autoKey = "var-file-default" - preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename) - } - - if _, err = os.Stat(DefaultVarsFilename + ".json"); err == nil { - m.autoKey = "var-file-default" - preArgs = append(preArgs, "-"+m.autoKey, DefaultVarsFilename+".json") - } - err = nil for err != io.EOF { var fis []os.FileInfo