Skip to content

Commit

Permalink
detect need to update tlmgr
Browse files Browse the repository at this point in the history
Fixes #7087
  • Loading branch information
dragonstyle committed Sep 30, 2023
1 parent ce7e9d4 commit 526d38a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/command/render/latexmk/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ async function initialCompileLatex(
quiet?: boolean,
) {
let packagesUpdated = false;
let tlmgrUpdated = false;
while (true) {
// Run the pdf engine
const response = await runPdfEngine(
Expand Down Expand Up @@ -196,6 +197,7 @@ async function initialCompileLatex(
logProgress("updating tlmgr");
}
await pkgMgr.updatePackages(false, true);
tlmgrUpdated = true;
info("");

if (!quiet) {
Expand All @@ -205,6 +207,25 @@ async function initialCompileLatex(
packagesUpdated = true;
}

const logText = Deno.readTextFileSync(response.log);
// See if tlmgr just needs to be updated
// https://github.com/rstudio/tinytex/commit/5946a2a1bf3c6ecefbd1213178a4e473ff4c26dc
// https://github.com/quarto-dev/quarto-cli/issues/7087
if (logText.match(/.* Loading '([^']+)' aborted!/)) {
if (!tlmgrUpdated) {
continue;
} else {
// We've already tried updating, just need to throw and die
// We failed to install packages (but there are missing packages), give up
displayError(
"tlmgr needs to be updated, but the update failed",
response.log,
response.result,
);
return Promise.reject();
}
}

// Try to find and install packages
const packagesInstalled = await findAndInstallPackages(
pkgMgr,
Expand Down

0 comments on commit 526d38a

Please sign in to comment.