Skip to content

Fix ir run on rig-managed Windows - #41

Merged
cderv merged 1 commit into
mainfrom
windows-fixes
Jun 4, 2026
Merged

cderv merged 1 commit into
mainfrom
windows-fixes

Conversation

@cderv

@cderv cderv commented Jun 4, 2026 •

Copy link
Copy Markdown
Collaborator

On a rig-managed Windows machine, ir run fails before reaching R, and even with an explicit --r-version the .qmd render aborts in quarto. Two separate Windows-only bugs (#32).

Default-R resolution hits the .bat shim

With no --r-version, resolution falls back to the bare name Rscript. On a rig-managed Windows box the only Rscript on PATH is Rscript.bat (from rig system make-links), and std::process::Command resolves .exe only — it won't spawn a .bat:

could not find `Rscript` on PATH. Install R, or set IR_RSCRIPT to its path.

The default install's real Rscript.exe is now resolved from rig list --json ("default": true → its binary), the same mechanism the --r-version path already uses. IR_RSCRIPT stays the top override; non-rig systems and Unix fall back to bare Rscript unchanged.

Canonicalised script paths break quarto

The script path was canonicalised for CWD-independence. On Windows fs::canonicalize returns a \\?\C:\... verbatim path that Rscript tolerates but quarto's Deno expandGlobSync cannot stat:

ERROR: (os error 123): stat '\\?\C:\Users\...\e2e.qmd'

The path is now passed through untouched. R and quarto both inherit ir's working directory, so a relative path resolves exactly as the user typed it — no canonicalisation, no verbatim prefix. An existence check keeps the clear "cannot read script" error.

Verified locally on a rig-managed Windows box: a default-R .R run and a --r-version .qmd render both succeed with the fixes.

Fixes #32

Comment thread src/main.rs Outdated
@cderv
cderv changed the base branch from windows-e2e-tests to main June 4, 2026 15:17
Two Windows-only failures blocked `ir run` (#32).

The no-`--r-version` path resolved the bare name `Rscript`, which on a
rig-managed Windows install is only `Rscript.bat` (from `rig system
make-links`). `std::process::Command` resolves `.exe` only and won't
spawn a `.bat`, so the run failed before reaching R. Resolve the default
install's real `Rscript.exe` from `rig list --json` instead — the same
mechanism the `--r-version` path already uses — keeping `IR_RSCRIPT` as
the top override and falling back to bare `Rscript` off rig.

The script path was canonicalised for CWD-independence, but on Windows
`fs::canonicalize` yields a `\\?\C:\...` verbatim path that quarto's Deno
`expandGlobSync` cannot stat (`os error 123`). The path is now passed
through untouched: R and quarto inherit `ir`'s working directory, so a
relative path resolves as the user typed it. An existence check keeps the
clear "cannot read script" error.
@cderv

cderv commented Jun 4, 2026

Copy link
Copy Markdown
Collaborator Author

The test (windows-latest) failure here is pre-existing on main since #39 — the same 5 fixture tests fail identically there (e.g. runs 26959944760, 26958971343), independent of this change. Root-caused in #46: sessioninfo system2(env=) crashes on Windows (r-lib/sessioninfo#122), a quarto cross-drive --output-dir join, and reticulate Python discovery on the runner.

None of those touch this PR's diff (main.rs/rig.rs). And the CI job uses r-lib setup-r (real Rscript.exe), so it never exercises the rig .bat shim or default-R resolution these fixes target — that path was validated locally on a rig-managed Windows box.

@cderv
cderv merged commit 95de01b into main Jun 4, 2026
3 of 4 checks passed
@cderv
cderv deleted the windows-fixes branch June 4, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix WIndows

2 participants