Skip to content

Commit e5393bc

Browse files
committed
Override Rscript just for the parent process
1 parent 6d6ac97 commit e5393bc

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

.github/workflows/R-CMD-check-occasional.yaml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,19 @@ jobs:
9292
with:
9393
r-version: ${{ matrix.r }}
9494

95-
- name: Override R for locale-specific check
95+
- name: Override Rscript for locale-specific check
9696
if: matrix.os == 'ubuntu-latest' && !contains(matrix.locale, 'utf8')
9797
run: |
98-
R_BIN_DIR=$(Rscript -e 'cat(R.home("bin"))')
99-
for bin in R Rscript; do
100-
target="${R_BIN_DIR}/${bin}"
101-
sudo mv "$target" "${target}.orig"
102-
sudo tee "$target" << EOF
98+
RSCRIPT_PATH="$HOME/.local/bin"
99+
mkdir -p "$RSCRIPT_PATH"
100+
echo "$RSCRIPT_PATH" >> "$GITHUB_PATH"
101+
target="$RSCRIPT_PATH/Rscript"
102+
tee "$target" << EOF
103103
#!/bin/bash
104104
set -o pipefail
105-
exec "${target}.orig" "\$@" 2>&1 | iconv -c -t UTF-8
105+
exec "$(which Rscript)" "\$@" 2>&1 | iconv -c -t UTF-8
106106
EOF
107-
sudo chmod +x "$target"
108-
done
107+
chmod +x "$target"
109108
110109
- name: Set script permissions
111110
run: chmod +x configure cleanup 2>/dev/null || true # Silence some GHA Annotations

0 commit comments

Comments
 (0)