Skip to content

Restore RIG_MODE when configure-test-env.ps1 is interrupted - #15333

Merged
cderv merged 1 commit into
mainfrom
fix/rig-mode-cleanup
Nov 12, 2026
Merged

cderv merged 1 commit into
mainfrom
fix/rig-mode-cleanup

Conversation

@cderv

@cderv cderv commented Nov 10, 2026

Copy link
Copy Markdown
Member

Follow-up to #15327. configure-test-env.ps1 sets RIG_MODE=user for 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 during rig add or rig proj sync (Ctrl+C during a long R download), or any error that stops the script, left RIG_MODE=user set in the PowerShell session that run-tests.ps1 dot-sources the script into.

The R setup now runs in try/finally and the variable is removed in finally, which PowerShell also runs when the script is stopped with Ctrl+C. An explicitly set RIG_MODE is still left untouched. Most of the diff is re-indentation, git diff -w shows the actual change.

Checked on Windows by replacing rig with a function that throws on rig add: before, RIG_MODE stayed user; after, it is unset, and a preset RIG_MODE=admin is 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):

  • referenced the GitHub issue this PR closes
  • updated the appropriate changelog in the PR
  • ensured the present test suite passes
  • added new tests
  • created a separate documentation PR in Quarto's website repo and linked it to this PR
AI-assisted PR
  • AI tool used: Claude Code
  • Codebase grounding: local clone
  • Human review: I have reviewed, tested, and verified the AI-generated content before submitting.

Note: autonomous AI agents submitting PRs without human oversight are not permitted — see the Code of Conduct.

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.
@posit-snyk-bot

posit-snyk-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues
✅ Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@cderv
cderv merged commit 11a9c60 into main Nov 12, 2026
52 checks passed
@cderv
cderv deleted the fix/rig-mode-cleanup branch November 12, 2026 09:32
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.

2 participants