Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli-plugins: PluginRunCommand: use cmd.Environ instead of os.Environ #5038

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

thaJeztah
Copy link
Member

Commit 5011759 implemented a fix that caused the current environment to be discarded, using os.Environ(). On Windows, os.Environ() may produce an incorrect value for PWD, for which a new function was added in go1.19;

Replace the use of os.Environ() with cmd.Environ() to address that.

- What I did

- How I did it

- How to verify it

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Commit 5011759 implemented a fix that
caused the current environment to be discarded, using `os.Environ()`.
On Windows, `os.Environ()` may produce an incorrect value for `PWD`,
for which a new function was added in go1.19;

- https://tip.golang.org/doc/go1.19#osexecpkgosexec
- https://go-review.googlesource.com/c/go/+/401340

Replace the use of `os.Environ()` with `cmd.Environ()` to address that.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
@thaJeztah
Copy link
Member Author

cc @laurazard please double-check if this is the correct change to make 🙈 (I recall this was the recommended thing to do nowadays, but maybe plugins are special here 😅)

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 61.09%. Comparing base (7f15dfa) to head (5ccb484).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5038   +/-   ##
=======================================
  Coverage   61.08%   61.09%           
=======================================
  Files         295      295           
  Lines       20660    20659    -1     
=======================================
  Hits        12621    12621           
+ Misses       7142     7141    -1     
  Partials      897      897           

Copy link
Member

@laurazard laurazard left a comment

Choose a reason for hiding this comment

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

Nice catch, thanks!

@vvoland vvoland added this to the 26.1.1 milestone Apr 29, 2024
@thaJeztah
Copy link
Member Author

@vvoland I see you added the 26.1.1 milestone; was the intent to backport this, or should it be on 27.0 ?

@vvoland vvoland modified the milestones: 26.1.1, 27.0.0 Apr 29, 2024
@vvoland
Copy link
Collaborator

vvoland commented Apr 29, 2024

Yeah, it should be on 27.0 🙈

Still, looks like something that would be good to backport.

@thaJeztah
Copy link
Member Author

Thx! Let me bring this one in 👍

Sign up for free to 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.

4 participants