Skip to content

Fix: plugin-tests discarding current environment - #1713

Merged
silvin-lubecki merged 1 commit into
docker:masterfrom
thaJeztah:fix_plugin_test
Mar 14, 2019
Merged

Fix: plugin-tests discarding current environment#1713
silvin-lubecki merged 1 commit into
docker:masterfrom
thaJeztah:fix_plugin_test

Conversation

@thaJeztah

Copy link
Copy Markdown
Member

By default, exec uses the environment of the current process, however,
if exec.Env is not nil, the environment is discarded:

https://github.com/golang/go/blob/e73f4894949c4ced611881329ff8f37805152585/src/os/exec/exec.go#L57-L60

If Env is nil, the new process uses the current process's environment.

When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.

By default, exec uses the environment of the current process, however,
if `exec.Env` is not `nil`, the environment is discarded:
https://github.com/golang/go/blob/e73f4894949c4ced611881329ff8f37805152585/src/os/exec/exec.go#L57-L60
> If Env is nil, the new process uses the current process's environment.
When adding a new environment variable, prepend the current environment,
to make sure it is not discarded.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #1713 into master will not change coverage.
The diff coverage is n/a.

@@ Coverage Diff @@## master #1713 +/- ##
=======================================
Coverage 56.18% 56.18% =======================================
Files 306 306 Lines 21006 21006 =======================================
Hits 11803 11803 Misses 8349 8349 Partials 854 854

@vdemeestervdemeester left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🐯

@silvin-lubeckisilvin-lubecki left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@silvin-lubecki
silvin-lubecki merged commit 651ccc0 into docker:masterMar 14, 2019
@GordonTheTurtleGordonTheTurtle added this to the 19.03.0 milestone Mar 14, 2019
@thaJeztah
thaJeztah deleted the fix_plugin_test branch March 14, 2019 16:18
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@thaJeztah@codecov-io@vdemeester@silvin-lubecki@GordonTheTurtle