|
|
@@ -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}`,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
}
|