From f724071d8cd4a71091d9e6dadf170cefa187a8ca Mon Sep 17 00:00:00 2001 From: Walter Wanderley Date: Sat, 26 Aug 2023 18:51:28 -0300 Subject: [PATCH] fix: keep environment variables on calling plugin --- internal/ext/process/gen.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/ext/process/gen.go b/internal/ext/process/gen.go index dc39a15fd8..05042a216d 100644 --- a/internal/ext/process/gen.go +++ b/internal/ext/process/gen.go @@ -5,6 +5,7 @@ import ( "context" "errors" "fmt" + "os" "os/exec" "google.golang.org/protobuf/proto" @@ -31,9 +32,7 @@ func (r Runner) Generate(ctx context.Context, req *plugin.CodeGenRequest) (*plug cmd := exec.CommandContext(ctx, path) cmd.Stdin = bytes.NewReader(stdin) - cmd.Env = []string{ - fmt.Sprintf("SQLC_VERSION=%s", req.SqlcVersion), - } + cmd.Env = append(os.Environ(), fmt.Sprintf("SQLC_VERSION=%s", req.SqlcVersion)) out, err := cmd.Output() if err != nil {