Skip to content

Fix variable expansion in dotenv run --no-override - #698

Open
ROTl24 wants to merge 1 commit into
theskumar:mainfrom
ROTl24:fix/cli-no-override-interpolation
Open

Fix variable expansion in dotenv run --no-override#698
ROTl24 wants to merge 1 commit into
theskumar:mainfrom
ROTl24:fix/cli-no-override-interpolation

Conversation

@ROTl24

@ROTl24 ROTl24 commented Sep 8, 2026

Copy link
Copy Markdown

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 receive BASE=environment alongside DERIVED=file/suffix.

This change passes the CLI's override option to DotEnv, 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-override cases 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/bin was included in the test process PATH. All nine upstream CI jobs also passed on Linux and Windows.

Prepared with OpenAI Codex assistance.

@ROTl24 ROTl24 changed the title Fix CLI --no-override interpolation precedence Fix variable expansion in dotenv run --no-override Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dotenv run --no-override expands variables with the wrong precedence

1 participant