Repository navigation
Restore RIG_MODE when configure-test-env.ps1 is interrupted - #15333
Merged
Merged
Conversation
configure-test-env.ps1 sets RIG_MODE=user when it is unset and removed it only at the end of the R block. Interrupting `rig add` or `rig proj sync` (Ctrl+C during a long R download) or any terminating error skipped that line, so RIG_MODE=user stayed in the calling shell. run-tests.ps1 dot-sources the script, and environment variables are process-wide in PowerShell anyway. The removal now runs in a finally block, which PowerShell also runs on Ctrl+C. An explicitly set RIG_MODE is still left untouched. Most of the diff is re-indentation of the R block. Checked on Windows by shadowing rig with a function that throws on `rig add`: before, RIG_MODE was left as "user"; after, it is unset, and a preset RIG_MODE=admin is kept. The R section run with the real rig still installs R 4.6.2 in user mode, syncs the lock and installs dev knitr and rmarkdown, and leaves RIG_MODE unset.
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
5 tasks
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.
Follow-up to #15327.
configure-test-env.ps1setsRIG_MODE=userfor the R setup when the variable is unset, and removes it again at the end so it does not stay in the caller's shell. That removal only ran when the R setup completed. Stopping the script duringrig addorrig proj sync(Ctrl+C during a long R download), or any error that stops the script, leftRIG_MODE=userset in the PowerShell session thatrun-tests.ps1dot-sources the script into.The R setup now runs in
try/finallyand the variable is removed infinally, which PowerShell also runs when the script is stopped with Ctrl+C. An explicitly setRIG_MODEis still left untouched. Most of the diff is re-indentation,git diff -wshows the actual change.Checked on Windows by replacing
rigwith a function that throws onrig add: before,RIG_MODEstayeduser; after, it is unset, and a presetRIG_MODE=adminis kept. The R setup with the real rig still installs R 4.6.2 in user mode, syncs the lock and installs dev knitr and rmarkdown.Checklist
I have (if applicable):
AI-assisted PR
Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.