From d5468a4c6f2c99c899f9c30d3f6574a3619c44d6 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Wed, 3 May 2023 16:05:08 +0200 Subject: [PATCH] Another fix for storing the result (#3830) --- bin/sitespeed.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/sitespeed.js b/bin/sitespeed.js index 4822c9a32..c3219cc76 100755 --- a/bin/sitespeed.js +++ b/bin/sitespeed.js @@ -115,6 +115,8 @@ async function start() { parsed.options.urlsMetaData = parsed.urlsMetaData; let options = parsed.options; + process.exitCode = 1; + if (options.api && options.api.hostname) { api(options); } else { @@ -123,8 +125,13 @@ async function start() { // This can be used as an option to get hold of where the data is stored // for third parties - if (options.storeResult == 'true') { - writeFileSync('result.json', JSON.stringify(result)); + if (options.storeResult) { + if (options.storeResult == 'true') { + writeFileSync('result.json', JSON.stringify(result)); + } else { + // Use the name supplied + writeFileSync(options.storeResult, JSON.stringify(result)); + } } if (result.errors.length > 0) {