Fix command tests failing on Windows without Unix coreutils#341
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Windows, eight tests in
pampaandquarto-system-runtimepanic withRuntimeError("I/O error: program not found"). They runecho,false, andcatthrough 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.exeinusr/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_commandspawns the program directly with no shell, matching Pandoc'spandoc.system.command— a filter author callingpandoc.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
System32—cmd /C echo,cmd /C exit 1, andfindstr "^"for stdin echo — via cfg-gated test helpers. Unix keepsecho/false/cat. The two byte-exact stdin round-trip assertions trim trailing newlines, sincefindstrappends 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