diff --git a/scripts/utils.js b/scripts/utils.js index 2050b05b7cd..056d95b7b09 100644 --- a/scripts/utils.js +++ b/scripts/utils.js @@ -95,8 +95,17 @@ export async function exec(command, args, options) { const ok = code === 0 const stderr = Buffer.concat(stderrChunks).toString().trim() const stdout = Buffer.concat(stdoutChunks).toString().trim() - const result = { ok, code, stderr, stdout } - resolve(result) + + if (ok) { + const result = { ok, code, stderr, stdout } + resolve(result) + } else { + reject( + new Error( + `Failed to execute command: ${command} ${args.join(' ')}: ${stderr}`, + ), + ) + } }) }) }