Skip to content

Commit 2d6cfbf

Browse files
committed
fix!: check exitCode for failed commands
resolves #193
1 parent 0d50538 commit 2d6cfbf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/_utils.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,18 @@ export async function executeCommand(
6767
? [command, args]
6868
: ["corepack", [command, ...args]];
6969

70-
await x(xArgs[0], xArgs[1], {
70+
const { exitCode, stdout, stderr } = await x(xArgs[0], xArgs[1], {
7171
nodeOptions: {
7272
cwd: resolve(options.cwd || process.cwd()),
7373
stdio: options.silent ? "pipe" : "inherit",
7474
},
7575
});
76+
77+
if (exitCode !== 0) {
78+
throw new Error(
79+
`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? ["", stdout, stderr].join("\n") : ""}`,
80+
);
81+
}
7682
}
7783

7884
type NonPartial<T> = { [P in keyof T]-?: T[P] };

0 commit comments

Comments
 (0)