Skip to content

Commit 0a95fb2

Browse files
rsc 0.18.0
Merge branch 'release/0.18.0'
2 parents ab0b78e + 136b663 commit 0a95fb2

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

NEWS.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## Version 0.18.0 [2025-04-23]
2+
3+
### New Features
4+
5+
* Add new environment argument `RSC_HELP_URL`, which if set will be
6+
mentioned in the `--help` output as well as being appended to any
7+
error messages produced.
8+
9+
110
## Version 0.17.0 [2024-11-10]
211

312
### New Features

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,22 +333,22 @@ As before, the RStudio Server is available at
333333
334334
```sh
335335
$ cd /path/to/software
336-
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.17.0.tar.gz
337-
$ tar xf 0.17.0.tar.gz
338-
$ PATH=/path/to/softwarerstudio-server-controller-0.17.0/bin:$PATH
336+
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.18.0.tar.gz
337+
$ tar xf 0.18.0.tar.gz
338+
$ PATH=/path/to/softwarerstudio-server-controller-0.18.0/bin:$PATH
339339
$ export PATH
340340
$ rsc --version
341-
0.17.0
341+
0.18.0
342342
```
343343
344344
To verify that the tool can find R and the RStudio Server executables,
345345
call:
346346
347347
```sh
348348
$ rsc --version --full
349-
rsc: 0.17.0
350-
RStudio Server: 2023.06.2+561 (Mountain Hydrangea) for Linux [/path/to/rstudio-server/bin/rstudio-server]
351-
R: 4.3.1 (2023-06-16) -- "Shortstop Beagle" [/path/to/R/bin/R]
349+
rsc: 0.18.0
350+
RStudio Server: 2024.09.1-394 (Cranberry Hibiscus) for Linux [/path/to/rstudio-server/bin/rstudio-server]
351+
R: 4.5.0 (2025-04-11) -- "How About a Twenty-Six" [/path/to/R/bin/R]
352352
```
353353
354354

bin/rsc

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@
7575
### rsc reset --force
7676
### rsc reset --which=sessions
7777
###
78-
### Version: 0.17.0
78+
### {{SEE_ALSO}}
79+
###
80+
### Version: 0.18.0
7981
### Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
8082
### License: ISC
8183

@@ -135,7 +137,10 @@ function rsc_error {
135137
if [[ -n ${extra} ]]; then
136138
msg="${msg} ${extra}"
137139
fi
138-
error "$msg"
140+
if [[ -n ${RSC_HELP_URL} ]]; then
141+
msg="${msg} See also <${RSC_HELP_URL}>, which may have additional details on and suggestions how to solve this."
142+
fi
143+
error "${msg}"
139144
}
140145

141146
# -------------------------------------------------------------------------
@@ -293,7 +298,7 @@ function acquire_lock_file {
293298
if [[ -f "${lockfile}" ]]; then
294299
msg="${USER}, another RStudio Server instance of yours is already running on $(rserver_hostname) on this system. Call '${blue}rsc status --full${undo}' for details on how to reconnect. If you want to start a new instance, please terminate the existing one first by calling '${blue}rsc stop${undo}' from that machine."
295300
msg="${msg} As a last resort, for instance, if that machine is no longer available or down for maintenance, try ${blue}rsc reset --force${undo}."
296-
error "${msg}"
301+
rsc_error "${msg}"
297302
fi
298303
echo "${PPID}" > "${lockfile}"
299304
assert_file_is_not_empty "${lockfile}"
@@ -575,7 +580,7 @@ function check_pid {
575580
if [[ ${okay} -ne 0 ]]; then
576581
## Remove empty leading lines
577582
res=$(sed -e '/./,$!d' <<< "${res}")
578-
error "Failed to check process PID ${pid} on ${hostname} over SSH. Reason was: ${res}"
583+
rsc_error "Failed to check process PID ${pid} on ${hostname} over SSH. Reason was: ${res}"
579584
fi
580585
[[ "${res}" == "true" ]] && pid_exists=true
581586
else
@@ -961,7 +966,7 @@ function assert_no_rsession {
961966
if [[ $(rserver_status) == "not running" ]]; then
962967
error "Detected stray 'rsession' processes. Use 'rsc stop' to terminate them"
963968
else
964-
error "[INTERNAL] Detected unexpected 'rsession' processes"
969+
rsc_error "[INTERNAL] Detected unexpected 'rsession' processes"
965970
fi
966971
fi
967972

@@ -1483,6 +1488,18 @@ function display_access_instructions {
14831488
message "\n${msg}"
14841489
}
14851490

1491+
function rsc_help {
1492+
local -a bfr
1493+
mapfile -t bfr < <(help "${@}")
1494+
if grep -q -F "{{SEE_ALSO}}" <<< "${bfr[@]}"; then
1495+
if [[ -n ${RSC_HELP_URL} ]]; then
1496+
mapfile -t bfr < <(printf "%s\n" "${bfr[@]}" | sed "s/{{SEE_ALSO}}/See also:\n * <${RSC_HELP_URL//\//\\/}>/")
1497+
else
1498+
mapfile -t bfr < <(printf "%s\n" "${bfr[@]}" | sed "/{{SEE_ALSO}}/{ N; d }")
1499+
fi
1500+
fi
1501+
printf "%s\n" "${bfr[@]}"
1502+
}
14861503

14871504
# =========================================================================
14881505
# MAIN
@@ -1622,10 +1639,10 @@ done
16221639

16231640
## --help should always be available prior to any validation errors
16241641
if [[ -z $action ]]; then
1625-
help
1642+
rsc_help
16261643
_exit 0
16271644
elif [[ $action == "help" ]]; then
1628-
help full
1645+
rsc_help full
16291646
_exit 0
16301647
elif [[ $action == "version" ]]; then
16311648
if $full; then
@@ -1882,7 +1899,7 @@ elif [[ "${action}" == "stop" ]]; then
18821899
## If running, make sure we're stopping from the correct machine
18831900
if [[ -f "${lockfile}" ]] && [[ "$(hostname)" != "$(rserver_hostname)" ]]; then
18841901
file="${workdir}/rserver.hostname"
1885-
error "Stopping the RStudio Server can only be made from the machine ($(rserver_hostname)) where it was started from - not from $(hostname) [${file}: $(file_info "${file}")]"
1902+
rsc_error "Stopping the RStudio Server can only be made from the machine ($(rserver_hostname)) where it was started from - not from $(hostname) [${file}: $(file_info "${file}")]"
18861903
fi
18871904

18881905
## Terminate rsession
@@ -2006,7 +2023,7 @@ elif [[ "${action}" == "start" ]]; then
20062023
secure_dir
20072024

20082025
rs_pid="$(rserver_pid)"
2009-
[[ -z "${rs_pid}" ]] && error "RStudio Server failed to start for unknown reasons. One reason for this might be that the port (${port}) is already occupied"
2026+
[[ -z "${rs_pid}" ]] && rsc_error "RStudio Server failed to start for unknown reasons. One reason for this might be that the port (${port}) is already occupied"
20102027
pids=("${rs_pid}")
20112028

20122029
## Update 'port', in case it 'port4me' was used
@@ -2015,7 +2032,7 @@ elif [[ "${action}" == "start" ]]; then
20152032
## Launch rserver monitor
20162033
launch_rserver_monitor
20172034
pid="$(rserver_monitor_pid)"
2018-
[[ -z "${pid}" ]] && error "rserver monitor failed to start for unknown reasons"
2035+
[[ -z "${pid}" ]] && rsc_error "rserver monitor failed to start for unknown reasons"
20192036
pids=("${pid}")
20202037

20212038
## Launch reverse SSH tunnel?

0 commit comments

Comments
 (0)