From 40e8ce12c03d9e11197876f7c70f2ce8e9993036 Mon Sep 17 00:00:00 2001 From: Daniel Chaplin Date: Fri, 14 Apr 2023 14:08:16 +0300 Subject: [PATCH] ignore .env if not a file --- cli/options.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cli/options.go b/cli/options.go index ecae4d2ee..31e791eb4 100644 --- a/cli/options.go +++ b/cli/options.go @@ -277,6 +277,14 @@ func GetEnvFromFile(currentEnv map[string]string, workingDir string, filenames [ } dotEnvFile = abs + s, err := os.Stat(dotEnvFile) + if os.IsNotExist(err) { + return envMap, nil + } + if s.IsDir() { + return envMap, nil + } + b, err := os.ReadFile(dotEnvFile) if os.IsNotExist(err) { if len(filenames) > 0 {