diff --git a/scripts/check_3pp_licenses.js b/scripts/check_3pp_licenses.js index 242e56c60d3c6..cef0daa22345e 100644 --- a/scripts/check_3pp_licenses.js +++ b/scripts/check_3pp_licenses.js @@ -30,6 +30,7 @@ const dashLicensesJar = path.resolve(__dirname, 'download/dash-licenses.jar'); const dashLicensesSummary = path.resolve(__dirname, '../dependency-check-summary.txt'); const dashLicensesBaseline = path.resolve(__dirname, '../dependency-check-baseline.json'); const dashLicensesUrl = 'https://repo.eclipse.org/service/local/artifact/maven/redirect?r=dash-licenses&g=org.eclipse.dash&a=org.eclipse.dash.licenses&v=LATEST'; +const dashLicensesInternalError = 127; // A Eclipse Foundation Gitlab Personal Access Token, generated by an Eclipse committer, // is required to use dash-licenses in "review" mode. For more information see: @@ -71,12 +72,21 @@ async function main() { info(`Using "review" mode for project: ${project}`); args.push('-review', '-token', personalAccessToken); } - const dashError = getErrorFromStatus(spawn('java', args, { - stdio: ['ignore', 'ignore', 'inherit'] - })); + const dashStatus = spawn('java', args, { + stdio: ['ignore', 'inherit', 'inherit'] + }); + + const dashError = getErrorFromStatus(dashStatus); + if (dashError) { - warn(dashError); + if (dashStatus.status == dashLicensesInternalError) { + error(dashError); + error('Detected an internal error in dash-licenses - run inconclusive'); + process.exit(dashLicensesInternalError); + } + warn(dashError); } + const restricted = await getRestrictedDependenciesFromSummary(dashLicensesSummary); if (restricted.length > 0) { if (fs.existsSync(dashLicensesBaseline)) { @@ -235,6 +245,9 @@ function getErrorFromStatus(status) { if (typeof status.signal === 'string') { return `Command ${prettyCommand(status)} exited with signal: ${status.signal}`; } else if (status.status !== 0) { + if (status.status == dashLicensesInternalError) { + return `Command ${prettyCommand(status)} exit code (${status.status}) means dash-licenses has encountered an internal error`; + } return `Command ${prettyCommand(status)} exited with code: ${status.status}`; } }