Skip to content

Fix command tests failing on Windows without Unix coreutils#341

Merged
cscheid merged 2 commits into
mainfrom
bugfix/bd-c5bdf948-fix-windows-test-failures
Jun 25, 2026
Merged

Fix command tests failing on Windows without Unix coreutils#341
cscheid merged 2 commits into
mainfrom
bugfix/bd-c5bdf948-fix-windows-test-failures

Conversation

@cderv

@cderv cderv commented Jun 25, 2026

Copy link
Copy Markdown
Member

On Windows, eight tests in pampa and quarto-system-runtime panic with RuntimeError("I/O error: program not found"). They run echo, false, and cat through the no-shell command runner, and none of those exist as standalone executables on a stock Windows install.

The failure is PATH-dependent, which is why it surfaces inconsistently: a dev machine with Git Bash on PATH has MSYS2's echo.exe/false.exe/cat.exe in usr/bin, so the tests pass there. Bare PowerShell and CI have no such binaries, so the spawn fails.

This is a test problem, not a runtime bug. exec_command spawns the program directly with no shell, matching Pandoc's pandoc.system.command — a filter author calling pandoc.system.command('echo', …) on stock Windows would hit the same error. The runtime is correct and left unchanged.

Fix

Route the Windows cases through programs that always exist in System32cmd /C echo, cmd /C exit 1, and findstr "^" for stdin echo — via cfg-gated test helpers. Unix keeps echo/false/cat. The two byte-exact stdin round-trip assertions trim trailing newlines, since findstr appends CRLF while the runtime passes stdin through unchanged.

Verified locally: the eight tests pass from both PowerShell (coreutils-free PATH) and Git Bash (coreutils present).

Test Plan

  • Eight target tests pass from PowerShell (no coreutils on PATH)
  • Same tests still pass from Git Bash (coreutils present)
  • macOS/Linux unaffected (Unix arm unchanged)

cderv added 2 commits June 25, 2026 16:12
The pampa lua system.command tests and the quarto-system-runtime
exec_command/exec_pipe tests hardcoded Unix coreutils (echo/false/cat).
exec_command spawns the program directly with no shell, matching Pandoc,
so on a stock Windows box those names resolve to nothing and the tests
panic with 'program not found'. The failure was masked on dev machines
where Git Bash's usr/bin (MSYS2 coreutils) sits on PATH; it surfaces in
bare PowerShell and CI.

Route Windows through cmd.exe / findstr.exe (always present in System32)
via cfg-gated test helpers. The two byte-exact stdin round-trip
assertions trim trailing newlines, since findstr appends CRLF while the
runtime itself passes stdin through unchanged.
@cscheid cscheid merged commit c64e391 into main Jun 25, 2026
5 checks passed
@cscheid cscheid deleted the bugfix/bd-c5bdf948-fix-windows-test-failures branch June 25, 2026 16:06
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.

2 participants