fix(PATH): push PATH updates into os.environ on change #5054
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This issue was raised in
#5050.
If users (or
xontribs
) make use ofsubprocess
, thePATH
availableto
subprocess
is the value ofPATH
inos.environ
, which is set atthe first import of
os.environ
.This means (meant) that if a user updates their
PATH
inxonshrc
,those changes aren't visible to a bare
subprocess
call.(This is what
UPDATE_OS_ENVIRON
is nominally for, but since changes toPATH
are mutating a mutable object, we don't hit any of the__setitem__
checks in the env object).So, instead, I've added an explicit call to update the
os.environ
value of
PATH
after each mutating call to ourEnvPath
class, so thisshould also work for the various
_PATH
variables (e.g.LDD_LIBRARY_PATH
).For community
⬇️ Please click the 👍 reaction instead of leaving a
+1
or 👍 comment