hashicorp / go-plugin

Golang plugin system over RPC.
Mozilla Public License 2.0
5.25k stars 450 forks source link

Update client to prioritize supplied Env over os.Environ #201

Closed ernestrc closed 2 years ago

ernestrc commented 2 years ago

Client-supplied environment variables should have priority over the current environment, but they're currently overwritten.

The go stdlib deduplicates by removing the first key value pairs in Command.Env when executing a command, so changing the order of how we append it fixes this problem.

https://github.com/golang/go/blob/master/src/os/exec/exec.go#L158 https://github.com/golang/go/blob/master/src/os/exec/exec.go#L910

hashicorp-cla commented 2 years ago

CLA assistant check

Thank you for your submission! We require that all contributors sign our Contributor License Agreement ("CLA") before we can accept the contribution. Read and sign the agreement

Learn more about why HashiCorp requires a CLA and what the CLA includes

Have you signed the CLA already but the status is still pending? Recheck it.

ernestrc commented 2 years ago

Closing in favor of https://github.com/hashicorp/go-plugin/pull/163