Merge pull request #4404 from jwhonce/wip/panic

Refactor test to prevent panic
This commit is contained in:
OpenShift Merge Robot
2019-11-01 12:42:48 +01:00
committed by GitHub

View File

@ -68,7 +68,8 @@ func aliasFlags(f *pflag.FlagSet, name string) pflag.NormalizedName {
// Check if a file exists and is not a directory
func checkIfFileExists(name string) bool {
file, err := os.Stat(name)
if os.IsNotExist(err) {
// All errors return file == nil
if err != nil {
return false
}
return !file.IsDir()