Repository navigation
undo rig's RSTUDIO_WHICH_R in the gui launchd session - #19347
Merged
Merged
Conversation
An RStudio started outside the GUI login (from tmux, or over ssh) runs in a Background launchd session, where 'launchctl getenv/setenv/unsetenv' neither see nor change the RSTUDIO_WHICH_R that rig's agent exports to the GUI session. Run them through 'launchctl asuser' instead. Addresses #19229.
RStudio E2E - all platformsAll tests passed!
View / download the full reportView report online -- opens in the browser, no download needed. Available for 14 days. Download playwright-report.zip -- extract and open
All platforms - commit |
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.
Addresses #19229.
Summary
#19230 undoes what a user-mode
rig adddoes to the default R outside RStudio, including theRSTUDIO_WHICH_Rthat rig's LaunchAgent exports. That last part did nothing when RStudio was started outside the GUI login (from tmux, or over ssh): such a process is in a Background launchd session, and therelaunchctl getenv/setenv/unsetenvact on that session's environment, not the GUI session's. The snapshot and the restore both read"", saw no change, and leftRSTUDIO_WHICH_Rpointing at the newly installed R for every app opened from the Finder or the Dock, until logout. The job verbs (list,load,unload) were not affected: from a Background session they still reach the GUI session's agents.The opt-in e2e had the same blind spot, so its check passed and its cleanup skipped the variable. A run under tmux left
RSTUDIO_WHICH_Rpointing into a deleted Playwright sandbox, after whichopen /Applications/RStudio.appfailed with "An unknown error occurred." (spawnSync ... ENOENTin the debug log), while launching the binary directly still worked.Changes
SessionRig.R:.rs.rig.launchctlrunsgetenv,setenvandunsetenvthroughlaunchctl asuser <uid> /bin/launchctl, which reaches the GUI session without privileges for one's own uid, and is the same session when RStudio already runs in it. The command-running code moved to.rs.rig.command.test-rig.R: covers which verbs are routed throughasuser, and that launchd's environment is left alone when the uid cannot be found.renv_r_version_switch.test.ts: reads and restoresRSTUDIO_WHICH_Rthroughasusertoo, so the check and the cleanup see the GUI session.Testing
PW_ALLOW_R_INSTALL=1 npm run test:desktop-dev -- tests/projects/renv_r_version_switch.test.ts -g "installs a missing R"), run under tmux: it fails with main'sSessionRig.R(RSTUDIO_WHICH_Rleft at the sandbox's rig R) and passes with this change; in both runs the GUI session's environment was clean afterwards.rigandlintertests.launchctl asuser $(id -u) /bin/launchctl getenv|setenv|unsetenvreads and changes the GUI session's environment from both a Background and an Aqua session.