Skip to content

Commit 4bc5eae

Browse files
committed
Set the env var in runScript directly
which seems a better way to take into account `quiet` option in addition to progress.
1 parent 979d0fb commit 4bc5eae

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

src/command/render/project.ts

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ export async function renderProject(
330330
...(projectRenderConfig.behavior.renderAll
331331
? { QUARTO_PROJECT_RENDER_ALL: "1" }
332332
: {}),
333-
"QUARTO_PROJECT_SCRIPT_PROGRESS": progress ? "1" : "0",
334333
};
335334

336335
// run pre-render step if we are rendering all files
@@ -960,24 +959,27 @@ async function runScripts(
960959
quiet: boolean,
961960
env?: { [key: string]: string },
962961
) {
962+
// initialize the environment if needed
963+
if (env) {
964+
env = {
965+
...env,
966+
};
967+
} else {
968+
env = {};
969+
}
970+
if (!env) throw new Error("should never get here");
971+
963972
for (let i = 0; i < scripts.length; i++) {
964973
const args = parseShellRunCommand(scripts[i]);
965974
const script = args[0];
966975

967-
if (progress) {
976+
if (progress && !quiet) {
968977
info(colors.bold(colors.blue(`Running script '${script}'`)));
978+
env["QUARTO_PROJECT_SCRIPT_PROGRESS"] = "1";
969979
}
970980

971981
const handler = handlerForScript(script);
972982
if (handler) {
973-
if (env) {
974-
env = {
975-
...env,
976-
};
977-
} else {
978-
env = {};
979-
}
980-
if (!env) throw new Error("should never get here");
981983
const input = Deno.env.get("QUARTO_USE_FILE_FOR_PROJECT_INPUT_FILES");
982984
const output = Deno.env.get("QUARTO_USE_FILE_FOR_PROJECT_OUTPUT_FILES");
983985
if (input) {

0 commit comments

Comments
 (0)