Another fix for storing the result (#3830)

This commit is contained in:
Peter Hedenskog 2023-05-03 16:05:08 +02:00 committed by GitHub
parent 4bfc1d5836
commit d5468a4c6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 2 deletions

View File

@ -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) {