Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: keep environment variables on calling plugin
  • Loading branch information
walterwanderley committed Aug 26, 2023
commit f724071d8cd4a71091d9e6dadf170cefa187a8ca
5 changes: 2 additions & 3 deletions internal/ext/process/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"context"
"errors"
"fmt"
"os"
"os/exec"

"google.golang.org/protobuf/proto"
Expand All @@ -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 {
Expand Down