From 090018c191db12a74507d0cb3fbb3d310191f046 Mon Sep 17 00:00:00 2001 From: claude Date: Sun, 31 May 2026 15:51:01 +0000 Subject: [PATCH] Fix QuartoRunner mv: use relative paths to avoid $COMPILE_DIR replacement bug LocalCommandRunner.replace() uses String.replace() which only substitutes the FIRST occurrence of '$COMPILE_DIR' in the shell script string. The mv commands had two more occurrences that stayed as literal '$COMPILE_DIR', which the shell expanded to '', making 'mv /main.pdf /output.pdf' fail silently. The file was produced (Quarto logged 'Output created: main.pdf') but never renamed to output.pdf, so the pipeline reported failure. Fix: mv uses relative filenames since the shell CWD is already the compile directory (set by LocalCommandRunner via the spawnCwd option). Co-Authored-By: Claude Sonnet 4.6 --- services/clsi/app/js/QuartoRunner.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/services/clsi/app/js/QuartoRunner.js b/services/clsi/app/js/QuartoRunner.js index f54048f0cd..1a7b60bebe 100644 --- a/services/clsi/app/js/QuartoRunner.js +++ b/services/clsi/app/js/QuartoRunner.js @@ -59,12 +59,13 @@ function _buildQuartoCommand(mainFile) { // expected by the rest of the pipeline. const inputPath = `$COMPILE_DIR/${mainFile}` const baseName = mainFile.replace(/\.[^/.]+$/, '') // strip extension - const pdfOut = `$COMPILE_DIR/${baseName}.pdf` - const htmlOut = `$COMPILE_DIR/${baseName}.html` + // LocalCommandRunner.replace() only replaces the FIRST $COMPILE_DIR + // occurrence in the shell string, so the mv commands use relative paths + // instead — the shell CWD is already set to the compile directory. const cmd = `quarto render ${inputPath} --embed-resources 2>&1 && ` + - `(mv ${pdfOut} $COMPILE_DIR/output.pdf 2>/dev/null || ` + - `mv ${htmlOut} $COMPILE_DIR/output.html 2>/dev/null)` + `(mv ${baseName}.pdf output.pdf 2>/dev/null || ` + + `mv ${baseName}.html output.html 2>/dev/null)` return ['/bin/sh', '-c', cmd] }