Print the error message from conf scripts at once (#41)

Printing them line by line will generate a bunch of error messages on
the summary page of GitHub Actions workflow. I think it's a bit
annoying.

Note that this change will also affect the format of the final output
error message, but no information will be lost.
This commit is contained in:
Mozi
2021-05-26 21:32:04 +08:00
committed by GitHub
parent c5426bf30a
commit 985d494a0f
+7 -9
View File
@@ -126,19 +126,17 @@ function main() {
// If vsvars.bat is given an incorrect command line, it will print out
// an error and *still* exit successfully. Parse out errors from output
// which don't look like environment variables, and fail if appropriate.
var failed = false
for (let line of vcvars_output) {
const error_messages = vcvars_output.filter((line) => {
if (line.match(/^\[ERROR.*\]/)) {
failed = true
// Don't print this particular line which will be confusing in output.
if (line.match(/Error in script usage. The correct usage is:$/)) {
continue
if (!line.match(/Error in script usage. The correct usage is:$/)) {
return true
}
core.error(line)
}
}
if (failed) {
throw new Error('invalid parameters')
return false
})
if (error_messages.length > 0) {
throw new Error('invalid parameters' + '\r\n' + error_messages.join('\r\n'))
}
// Convert old environment lines into a dictionary for easier lookup.