Fix variable expansion in dotenv run --no-override - #698
Open
ROTl24 wants to merge 1 commit into
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #697.
With
dotenv run --no-override, a variable keeps its existing environment value, but references to it still expand using the value in.env. For example, the child process can receiveBASE=environmentalongsideDERIVED=file/suffix.This change passes the CLI's
overrideoption toDotEnv, which already handles both expansion orders. References now use the same precedence as the variables passed to the child process.The regression test launches a real child process and checks both values. It covers the default mode,
--override, and--no-override, with the existing variable absent, nonempty, or empty. The two conflicting--no-overridecases fail without the fix.Validation: 214 tests passed and 50 were skipped on Windows with Python 3.13.15. The existing tests need
printenv, so Git for Windows'usr/binwas included in the test process PATH. All nine upstream CI jobs also passed on Linux and Windows.Prepared with OpenAI Codex assistance.