From 03d810204ed154dd043d7d623b4bf65815c5672c Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 18 Jan 2024 10:34:02 -0700 Subject: [PATCH] Get docs job to exit when not serving --- doc/scripts/build.mjs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/doc/scripts/build.mjs b/doc/scripts/build.mjs index 9f4b98c4a2..ef544189aa 100644 --- a/doc/scripts/build.mjs +++ b/doc/scripts/build.mjs @@ -24,12 +24,16 @@ const sitedir = 'doc/dist/site'; const spinner = ora({hideCursor: false}).start(); const execPromise = util.promisify(exec); let childProcess; -let buildResults; +let buildResults = []; const bundleDirectories = [outdir, 'doc/etemplate2/_data']; let packageData = JSON.parse(readFileSync(path.join(process.cwd(), 'package.json'), 'utf-8')); const egwVersion = JSON.stringify(packageData.version.toString()); +// Cleanup on exit +process.on('SIGINT', handleCleanup); +process.on('SIGTERM', handleCleanup); + // // Runs 11ty and builds the docs. The returned promise resolves after the initial publish has completed. The child // process and an array of strings containing any output are included in the resolved promise. @@ -53,6 +57,7 @@ async function buildTheDocs(watch = false) // To debug use this in terminal: DEBUG=Eleventy* npx @11ty/eleventy const child = spawn('npx', args, { + timeout: 60000, // 60s stdio: 'pipe', cwd: 'doc/etemplate2', shell: true // for Windows @@ -400,8 +405,5 @@ if (!serve) { console.log('\n' + result.output.join('\n')); } + process.exit(0); } - -// Cleanup on exit -process.on('SIGINT', handleCleanup); -process.on('SIGTERM', handleCleanup);