REditorSupport / REditorSupport/vscode-R

Using VScodeR terminal doesn't respect the local .Rprofile when parallel processes are launched

Open
#1,236 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.2k
Forks
139
Avg merge
2h 46m
Merged PRs (30d)
5

Description

Describe the bug
If you launch parallel processes via the parallel package in the R terminal generated by "Create R Terminal" then the users .Rprofile file is not respected.

To Reproduce

  • Create a empty directory
  • Add a .Rprofile file that contains print("hello world")
  • Load R terminal via "Create R terminal"
  • Create parallel processes via parallel::createCluster(2)
  • Notice that the "hello world" does not appear
  • Run this instead via the terminal i.e. Rscript -e 'parallel::makeCluster(2)' and notice that the "hello worlds" for the parallel processes do appear

Can you fix this issue by yourself? (We appreciate the help)

No

(If yes,) can we assist you with anything?

(If applicable) Please attach setting.json

Defaults, except:

    "r.alwaysUseActiveTerminal": true,
    "r.liveShare.defaults.shareWorkspace": false,
    "r.lsp.promptToInstall": false,
    "r.session.objectTimeout": 10,

Expected behavior
Expect that parallel sessions spawned within this terminal respect the users local .Rprofile (we depend heavily on it to setup libpaths.

Screenshots
image

  • Top left box - shows example script to be executed
  • Bottom left box - shows our .Rprofile file printing "hi"
  • Top right box - shows us executing the script manually in an R terminal created by this extension
  • Bottom right box - shows us executing the script via the terminal

Environment (please complete the following information):

Screenshot came from in house server but I was able to re-produce this on my local machine

  • OS: MacOS Montery
  • VSCode Version: 1.72.2
  • R Version: 4.2.1
  • vscode-R version: v2.6.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the process launched by “Create R Terminal” and compare it with the Rscript invocation shown in the reproduction. Trace how the terminal handles parallel::createCluster(2) and the local .Rprofile, then verify that parallel sessions print the profile’s message and preserve its library-path setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
r, typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.