When the user sets quarto.path to an absolute path of a Quarto build that ships only quarto.cmd on Windows (typical for the in-repo dev binary at package/dist/bin/quarto.cmd after ./configure.cmd), the extension's existence check passes but the subsequent version probe fails. The extension then silently falls back to the system PATH, so the user-specified dev binary is never actually used.
Mechanism
detectUserSpecifiedQuarto validates the file exists and is a file (passes for quarto.cmd), then calls detectQuarto(quartoPath):
|
function detectQuarto(quartoPath: string): QuartoInstallation | undefined { |
|
// detect version and paths (fall back to .cmd on windows if necessary) |
|
const windows = os.platform() == "win32"; |
|
let version: string | undefined; |
|
let paths: string[] | undefined; |
|
const readQuartoInfo = (bin: string) => { |
|
version = execProgram(bin, ["--version"]); |
|
paths = execProgram(bin, ["--paths"]).split(/\r?\n/); |
|
}; |
|
try { |
|
readQuartoInfo(quartoPath); |
|
} catch (e) { |
|
if (windows) { |
|
try { |
|
readQuartoInfo(quartoPath + ".cmd"); |
|
} catch (e) { /* */ } |
|
} |
|
} |
readQuartoInfo calls execProgram(quartoPath, ["--version"]). On Windows, child_process spawn on an absolute path to a .cmd file fails without shell: true because Windows requires cmd.exe to interpret .cmd files. The catch block retries with quartoPath + ".cmd" — but when the user already passed …\quarto.cmd, the retry becomes …\quarto.cmd.cmd, which does not exist. Both attempts fail, detectQuarto returns undefined, and the extension falls through to the PATH branch.
There is no warning surfaced — detectUserSpecifiedQuarto only warns when fs.existsSync or isFile checks fail, not when the version probe silently fails:
|
function detectUserSpecifiedQuarto( |
|
quartoPath: string, |
|
showWarning: (msg: string) => void |
|
): QuartoInstallation | undefined { |
|
// validate that it exists |
|
if (!fs.existsSync(quartoPath)) { |
|
showWarning( |
|
"Unable to find specified quarto executable: '" + quartoPath + "'" |
|
); |
|
return undefined; |
|
} |
|
|
|
// validate that it is a file |
|
if (!fs.statSync(quartoPath).isFile()) { |
|
showWarning( |
|
"Specified quarto executable is a directory not a file: '" + |
|
quartoPath + |
|
"'" |
|
); |
|
return undefined; |
|
} |
|
|
|
// detect |
|
return detectQuarto(quartoPath); |
|
} |
The useCmd flag only adjusts the execution-time path; it does not help at detection time:
|
const useCmd = windows && semver.lte(quartoInstall.version, "1.1.162"); |
Reproduction
On Windows:
- Clone
quarto-dev/quarto-cli, run ./configure.cmd. This produces package/dist/bin/quarto.cmd with no quarto.exe sibling.
- In Positron/VS Code settings, set
quarto.path to the absolute path of that quarto.cmd.
- Reload the window.
- Open a
.qmd and run any Quarto extension command (Preview, Verify Installation, render).
Observed: the dev binary is not used. The extension picks up whatever quarto is on PATH (in my case, a quarto-prerelease install from Scoop).
Quarto output channel log
[info] Activating Quarto extension.
[info] Searching for Quarto CLI...
[info] Checking quarto.path setting: C:/Users/chris/Documents/DEV_R/quarto-cli.worktrees/issue-14533/package/dist/bin/quarto.cmd
[info] Checking system PATH...
[info] Found Quarto 1.10.3 on system PATH
[info] Using Quarto 1.10.3 from C:\Users\chris\scoop\apps\quarto-prerelease\current\bin (found on system PATH)
[info] Activated Quarto extension.
Note: no warning between the quarto.path check and the PATH fallback. The user has no diagnostic indicating their setting was discarded.
Suggestion
We could either:
- Detect a trailing
.cmd on quartoPath at detection time and spawn with shell: true (or wrap in cmd /c).
- Or trim the trailing
.cmd from quartoPath before passing to readQuartoInfo, so the fallback at L208 can append .cmd cleanly without producing quarto.cmd.cmd.
- Or at minimum, surface a warning when the existence check passes but the version probe fails, so users get a clear diagnostic instead of silent fallback.
This blocks testing dev binaries against the extension end-to-end on Windows, which is what I hit while validating a quarto-cli fix that surfaces only when the extension is the client. Related to #352, which describes a different mechanism (terminal env-var prepend race on non-bash shells) producing the same user-visible symptom ("quarto.path is ignored").
When the user sets
quarto.pathto an absolute path of a Quarto build that ships onlyquarto.cmdon Windows (typical for the in-repo dev binary atpackage/dist/bin/quarto.cmdafter./configure.cmd), the extension's existence check passes but the subsequent version probe fails. The extension then silently falls back to the systemPATH, so the user-specified dev binary is never actually used.Mechanism
detectUserSpecifiedQuartovalidates the file exists and is a file (passes forquarto.cmd), then callsdetectQuarto(quartoPath):quarto/packages/quarto-core/src/context.ts
Lines 194 to 211 in dec89b2
readQuartoInfocallsexecProgram(quartoPath, ["--version"]). On Windows,child_processspawn on an absolute path to a.cmdfile fails withoutshell: truebecause Windows requirescmd.exeto interpret.cmdfiles. The catch block retries withquartoPath + ".cmd"— but when the user already passed…\quarto.cmd, the retry becomes…\quarto.cmd.cmd, which does not exist. Both attempts fail,detectQuartoreturnsundefined, and the extension falls through to the PATH branch.There is no warning surfaced —
detectUserSpecifiedQuartoonly warns whenfs.existsSyncorisFilechecks fail, not when the version probe silently fails:quarto/packages/quarto-core/src/context.ts
Lines 224 to 248 in dec89b2
The
useCmdflag only adjusts the execution-time path; it does not help at detection time:quarto/packages/quarto-core/src/context.ts
Line 138 in dec89b2
Reproduction
On Windows:
quarto-dev/quarto-cli, run./configure.cmd. This producespackage/dist/bin/quarto.cmdwith noquarto.exesibling.quarto.pathto the absolute path of thatquarto.cmd..qmdand run any Quarto extension command (Preview, Verify Installation, render).Observed: the dev binary is not used. The extension picks up whatever
quartois on PATH (in my case, aquarto-prereleaseinstall from Scoop).Quarto output channel log
Note: no warning between the
quarto.pathcheck and the PATH fallback. The user has no diagnostic indicating their setting was discarded.Suggestion
We could either:
.cmdonquartoPathat detection time and spawn withshell: true(or wrap incmd /c)..cmdfromquartoPathbefore passing toreadQuartoInfo, so the fallback at L208 can append.cmdcleanly without producingquarto.cmd.cmd.This blocks testing dev binaries against the extension end-to-end on Windows, which is what I hit while validating a
quarto-clifix that surfaces only when the extension is the client. Related to #352, which describes a different mechanism (terminal env-var prepend race on non-bash shells) producing the same user-visible symptom ("quarto.pathis ignored").