Add ability to show the current session ID
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
Research direction
Start by reviewing the existing rstudioapi entry points around terminalExecute and the RSTUDIO_SESSION_ID environment variable. Done means an R or RStudio caller can retrieve the current session ID directly, matching the value available from the Terminal.
Written by the indexing model from the issue text.
Description
It might prove useful to get the current session ID within RStudio, for use in the Console, R scripts, R Markdown, etc. Specifically, I have a case in which it's useful for conducting some testing. The value would be the same as the environment variable RSTUDIO_SESSION_ID that is available when opening the Terminal.
Meanwhile, I can sort of fake it with the Terminal:
temp <- rstudioapi::terminalExecute("echo -n $RSTUDIO_SESSION_ID > ~/current_session_id", show = FALSE)
session_id <- readr::read_file(file = "~/current_session_id")
session_id
results in
> temp <- rstudioapi::terminalExecute("echo -n $RSTUDIO_SESSION_ID > ~/current_session_id", show = FALSE)
> session_id <- readr::read_file(file = "~/current_session_id")
> session_id
[1] "d963e8cd"
>
Similarly with
term <- rstudioapi::terminalExecute("echo $RSTUDIO_SESSION_ID", show = FALSE)
while (is.null(rstudioapi::terminalExitCode(term))) { Sys.sleep(0.01) }
session_id <- rstudioapi::terminalBuffer(term)
- Dominant language
- R
- Stars
- 175
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rstudio/rstudioapi
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
rstudio/rstudioapi#313 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
rstudio/rstudioapi#321 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
rstudio/rstudioapi#318 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
rstudio/rstudioapi#315 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
rstudio/rstudioapi#314 ·
All issues in rstudio/rstudioapi
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
r-lib/pkgdepends#485 · 3 comments ·
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
beginners blocker
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enviPathR OpenBuild Error Build OK Build Warning policies-accepted pre-review precheck-passed
Difficulty 1/5 Under an hour Newbie friendliness 84/100
Bioconductor/BiocContributions#207 · 6 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
datacarpentry/semester-biology#1255 ·