Contribute R path, home, etc. to terminals#14886
Open
jmcphers wants to merge 1 commit into
Open
Conversation
|
E2E Tests 🚀 Why these tags?
More on automatic tags from changed files. |
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.
Fixes #7403
Summary
Terminals launched from Positron now use the same R installation as the active console. Previously the terminal always resolved
R/Rscriptfrom the systemPATH, so on a machine with multiple R versions the terminal ran a different R than the one selected in the console. This also broke extensions that start R in a terminal to do background work (Quarto Preview, Shiny Run App, etc.), since those tasks ran against the system default R rather than the version the user selected.The R extension now contributes terminal environment variables that point at the active console's R installation:
PATH- prepends the directory of the selected R binary soR,Rscript, and anything that shells out to them resolve to the selected version (mirrors howrigexposes a selected R via symlinks onPATH).R_HOME- set so tools that read it directly find the selected installation.QUARTO_R- points at theRscriptdirectory soquarto renderand the bundled Quarto extension use the selected R.The contributed environment is kept in sync as sessions are created, restored, and as the foreground console switches between R versions. When multiple R consoles run different versions, the most recently focused one wins; this ambiguity is expected and documented.
DYLD_LIBRARY_PATH/LD_LIBRARY_PATHare intentionally not contributed, even though the Ark kernel sets them: those affect dynamic linking for every program in the terminal (not just R) and can cause unrelated tools to load R's bundled libraries. R's own launcher scripts already configure their library paths, so they aren't needed for R to work from the terminal.Note
This does not attempt to address existing issues around environment modules and terminals; if R requires a
module loadto run, it still may not work in the terminal even after this change. That issue is tracked in #12850.Release Notes
New Features
Bug Fixes
PATH,R_HOME, andQUARTO_R(R version in Terminal doesn't match R version in Console (PATH,QUARTO_R,R_HOME, etc.) #7403)Validation Steps
@:quarto @:apps @:console
On a system with multiple R versions installed:
PATHas the console interpreter.R --version(andRscript --version) - it should report the version selected in the console, not the system default.Rscript -e 'R.home()'and confirmR_HOMEpoints at the selected installation; checkecho $QUARTO_R(or%QUARTO_R%on Windows) points at that R'sbindirectory.Unit coverage for the environment-mutation logic (PATH/R_HOME/QUARTO_R across posix and win32) lives in
extensions/positron-r/src/test/terminal-environment.unit.test.ts.