-
-
Notifications
You must be signed in to change notification settings - Fork 630
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(PATH): push PATH updates into
os.environ
on change
This issue was raised in #5050. If users (or `xontribs`) make use of `subprocess`, the `PATH` available to `subprocess` is the value of `PATH` in `os.environ`, which is set at the first import of `os.environ`. This means (meant) that if a user updates their `PATH` in `xonshrc`, those changes aren't visible to a bare `subprocess` call. (This is what `UPDATE_OS_ENVIRON` is nominally for, but since changes to `PATH` 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 our `EnvPath` class, so this should also work for the various `_PATH` variables (e.g. `LDD_LIBRARY_PATH`).
- Loading branch information
Showing
5 changed files
with
64 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
**Added:** | ||
|
||
* <news item> | ||
|
||
**Changed:** | ||
|
||
* <news item> | ||
|
||
**Deprecated:** | ||
|
||
* <news item> | ||
|
||
**Removed:** | ||
|
||
* <news item> | ||
|
||
**Fixed:** | ||
|
||
* Changes to ``$PATH`` are propagated to ``os.environ`` if | ||
``UPDATE_OS_ENVIRON=True`` so user and ``xontrib`` usage of ``subprocess`` | ||
reflects the current ``xonsh`` value for ``$PATH`` | ||
|
||
**Security:** | ||
|
||
* <news item> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters