Skip to content

Commit 093316c

Browse files
authored
Merge pull request #14731 from cderv/claude/typst-gather-which-await-t8dae2
Await which() in dependency configure guards
1 parent 57ead0e commit 093316c

7 files changed

Lines changed: 22 additions & 10 deletions

File tree

‎news/changelog-1.11.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ All changes included in 1.11:
22

33
## Regression fixes
44

5+
- ([#14731](https://github.com/quarto-dev/quarto-cli/pull/14731)): Fix `QUARTO_VENDOR_BINARIES=false` builds silently succeeding with missing binaries. The `configure` step's "is it on PATH?" check for `typst-gather`, `typst`, `pandoc` and `esbuild` compared an unawaited `Promise` against `undefined`, so the guard never fired. A build with `typst-gather` neither vendored nor on PATH reported success and produced a Quarto tree without it, surfacing only at render time as `typst-gather analyze failed; staging all packages as fallback`. The missing-binary error message now also names the path that was checked and the `QUARTO_TYPST_GATHER` environment variable.
56
- ([#14741](https://github.com/quarto-dev/quarto-cli/issues/14741)): Don't wrap the `longtable` environment of a cross-referenceable table in a `{ ... }` group. Pandoc emits that group to scope its `\longtablewidth`.
67
- ([#14857](https://github.com/quarto-dev/quarto-cli/issues/14857)): Fix `quarto install chrome-headless-shell` (and `quarto install chromium`) failing with a 404 on Linux arm64 due to a stale Playwright CDN URL.
78

‎package/src/common/dependencies/esbuild.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ export function esBuild(version: string): Dependency {
5656
}
5757
} else {
5858
// verify that the binary is on PATH, but otherwise don't do anything
59-
if (which(file) === undefined) {
59+
if ((await which(file)) === undefined) {
6060
throw new Error(
6161
`${file} is not on PATH. Please install it and add it to PATH.`,
6262
);

‎package/src/common/dependencies/pandoc.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function pandoc(version: string): Dependency {
7070
}
7171
} else {
7272
// verify that the binary is on PATH, but otherwise don't do anything
73-
if (which(pandocBinary) === undefined) {
73+
if ((await which(pandocBinary)) === undefined) {
7474
throw new Error(
7575
`${pandocBinary} is not on PATH. Please install it and add it to PATH.`,
7676
);

‎package/src/common/dependencies/typst-gather.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function typstGather(version: string): Dependency {
2828
Deno.renameSync(extractedPath, join(targetDir, file));
2929
} else {
3030
// verify that the binary is on PATH, but otherwise don't do anything
31-
if (which(file) === undefined) {
31+
if ((await which(file)) === undefined) {
3232
throw new Error(
3333
`${file} is not on PATH. Please install it and add it to PATH.`,
3434
);

‎package/src/common/dependencies/typst.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function typst(version: string ): Dependency {
4545
}
4646
} else {
4747
// verify that the binary is on PATH, but otherwise don't do anything
48-
if (which(file) === undefined) {
48+
if ((await which(file)) === undefined) {
4949
throw new Error(
5050
`${file} is not on PATH. Please install it and add it to PATH.`,
5151
);

‎src/command/dev-call/typst-gather/cmd.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,17 @@ export const typstGatherCommand = new Command()
4040
const typstGatherBinary = Deno.env.get("QUARTO_TYPST_GATHER") ||
4141
architectureToolsPath(binaryName);
4242
if (!existsSync(typstGatherBinary)) {
43-
error(
44-
`typst-gather binary not found.\n` +
45-
"Run ./configure.sh to build and install it.",
46-
);
43+
error(`typst-gather binary not found at ${typstGatherBinary}.`);
44+
if (Deno.env.get("QUARTO_TYPST_GATHER")) {
45+
error(
46+
"QUARTO_TYPST_GATHER is set but does not point to an existing file.",
47+
);
48+
} else {
49+
error(
50+
"Run ./configure.sh to download it, or set QUARTO_TYPST_GATHER to " +
51+
"the path of a typst-gather binary.",
52+
);
53+
}
4754
Deno.exit(1);
4855
}
4956

‎src/core/typst-gather.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,12 @@ export function typstGatherBinaryPath(): string {
3737

3838
if (!existsSync(binary)) {
3939
throw new Error(
40-
`typst-gather binary not found.\n` +
41-
`Run ./configure.sh to build and install it.`,
40+
`typst-gather binary not found at ${binary}.\n` +
41+
(Deno.env.get("QUARTO_TYPST_GATHER")
42+
? `QUARTO_TYPST_GATHER is set but does not point to an existing file.`
43+
: `Reinstall Quarto to restore the bundled binary, or set ` +
44+
`QUARTO_TYPST_GATHER to the path of a typst-gather binary.\n` +
45+
`In a Quarto source checkout, run ./configure.sh to download it.`),
4246
);
4347
}
4448

0 commit comments

Comments
 (0)