Fix juice failing on Windows when Quarto path contains spaces#14207
Merged
Fix juice failing on Windows when Quarto path contains spaces#14207
Conversation
Replace io.popen() with pandoc.pipe() in juice() to avoid shell word-splitting when the Quarto install path contains spaces (e.g., C:\Program Files\Quarto\). io.popen() concatenates the command as a string passed to the shell, which breaks at spaces. pandoc.pipe() calls the executable directly with arguments as an array, bypassing shell interpretation entirely. Fixes #14202
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
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.
When Quarto is installed in a path with spaces (e.g.,
C:\Program Files\Quarto\), rendering gt tables to Typst fails withRunning juice failed with exit code: 1, preceded by'C:\Program' is not recognized as an internal or external command.Root Cause
The
juice()function inastpipeline.luausesio.popen()with string concatenation to build the command. Whenquarto.config.cli_path()returns a path with spaces, the shell splits it at the space boundary —C:\Programis treated as the executable andFiles\...as a separate argument.Fix
Replace
io.popen()withpandoc.pipe(), which calls the executable directly with arguments as an array. No shell interpretation occurs, so spaces in any path component are handled correctly.This matches the existing pattern used in
shiny.luaandpdf-images.luafor external command execution.Verification
Tested by unzipping Quarto v1.9.33 prerelease into
C:\Users\chris\Quarto Test Space\, patching the bundledmain.luawith the same change, and rendering a gt table to Typst — the error no longer occurs. All existing juice-related smoke-all tests pass without regression:typst/juice/test.qmdtypst/juice/gt-table-images.qmdtypst/css-property-processing/default.qmdtypst/css-property-processing/translate.qmdtypst/css-property-processing/none.qmdFixes #14202