Skip to content

Commit

Permalink
Merge pull request #207 from kanisterio/env-dir-handle
Browse files Browse the repository at this point in the history
Add NotFound check to envdir
  • Loading branch information
tdmanv committed Aug 15, 2019
2 parents 77cbb4b + 0c290be commit 64fa09a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/envdir/envdir.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (
)

func EnvDir(dir string) ([]string, error) {
// Check if dir doesn't exist or it isn't a directory.
if fi, err := os.Stat(dir); os.IsNotExist(err) || !fi.IsDir() {
return nil, nil
}
fis, err := ioutil.ReadDir(dir)
if err != nil {
return nil, errors.Wrap(err, "failed to read env from dir:"+dir)
Expand Down

0 comments on commit 64fa09a

Please sign in to comment.