-
-
Notifications
You must be signed in to change notification settings - Fork 769
feat(exec): ensure MISE_ENV is set in spawned shell when specified via -E flag #7007
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the issue where the MISE_ENV environment variable was not being propagated to spawned shells when using the -E flag to specify an environment. The fix ensures that scripts running in the spawned shell can determine which mise environment context they're operating in.
Key Changes
- Modified
src/cli/exec.rsto explicitly setMISE_ENVin the spawned shell environment after building the environment map - Added comprehensive e2e test suite (
test_en_mise_env) to verify the behavior with single and multiple environments
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/cli/exec.rs | Adds logic to insert MISE_ENV into the environment map when it's non-empty, ensuring the variable is available in spawned shells |
| e2e/cli/test_en_mise_env | Comprehensive test suite with 16 test cases covering single environments, multiple environments, environment-specific config loading, and variable precedence |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Hi! I'm I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:
|
|
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
### 📦 Registry - added nelm by @tony-sol in [#7020](#7020) ### 🚀 Features - **(exec)** ensure MISE_ENV is set in spawned shell when specified via -E flag by @ceelian in [#7007](#7007) ### 🐛 Bug Fixes - **(go)** Don't allow auto mod=vendor mode by @mariduv in [#7006](#7006) - **(nushell)** test `use` not `source`, fix pipeline parse error by @jokeyrhyme in [#7013](#7013) - **(tasks)** make file paths relative to config location and templateable by @halms in [#7005](#7005) ### Chore - **(deny)** add exclusion for number_prefix by @jdx in [e955ecb](e955ecb) ### New Contributors - @mariduv made their first contribution in [#7006](#7006) - @ceelian made their first contribution in [#7007](#7007) ## 📦 Aqua Registry Updates #### New Packages (2) - [`blender/blender`](https://github.com/blender/blender) - [`werf/werf`](https://github.com/werf/werf) #### Updated Packages (1) - [`mas-cli/mas`](https://github.com/mas-cli/mas)
Description
This PR ensures that the
MISE_ENVenvironment variable is properly set in spawned shells when using themise execandmise encommand with the-Eflag to specify an environment. This solves the issue in the discussion #6928Changes
src/cli/exec.rsto check ifMISE_ENVis set (via the-Eflag) and ensure it's included in the environment variables passed to the spawned shelle2e/cli/test_en_mise_envto verify the behaviorProblem
When using
mise exec -E <env> -- <command>, theMISE_ENVvariable was not being propagated to the spawned shell environment, making it difficult for scripts to know which mise environment context they're running in. This also applied to themise -E <env> encommand, the command that made me aware of the issue.Solution
After building the environment with
env_with_path(), we now check ifMISE_ENVis set (populated by the-Eflag) and explicitly add it to the environment map before spawning the shell.Testing
Added comprehensive e2e test that verifies
MISE_ENVis properly set when usingmise -E <env> en.Note
Ensure
MISE_ENVis passed to spawned shells forexec/enwhen specified via-E, and add e2e tests validating propagation and precedence.src/cli/exec.rs, after building env withenv_with_path, explicitly insertMISE_ENV(comma-joined) into the spawned shell env when provided via-E.e2e/cli/test_en_mise_envcovering:MISE_ENVvisibility in spawned shell and config discovery for env-specific files.devandstaging, including multiple envs with order precedence.-E(noMISE_ENV, only base config applied).Written by Cursor Bugbot for commit 913eec2. This will update automatically on new commits. Configure here.