Skip to content

Commit edc5f26

Browse files
committed
chore: errexit
1 parent a4ebe59 commit edc5f26

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/scripts/libmongocrypt.mjs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,16 @@ async function parseArguments() {
5656

5757
/** `xtrace` style command runner, uses spawn so that stdio is inherited */
5858
async function run(command, args = [], options = {}) {
59-
console.error(`+ ${command} ${args.join(' ')}`, options.cwd ? `(in: ${options.cwd})` : '');
60-
await events.once(
61-
child_process.spawn(command, args, { stdio: 'inherit', cwd: resolveRoot('.'), ...options }),
62-
'exit'
63-
);
59+
const commandDetails = `+ ${command} ${args.join(' ')}${options.cwd ? ` (in: ${options.cwd})` : ''}`;
60+
console.error(commandDetails);
61+
const proc = child_process.spawn(command, args, {
62+
stdio: 'inherit',
63+
cwd: resolveRoot('.'),
64+
...options
65+
});
66+
await events.once(proc, 'exit');
67+
68+
if (proc.exitCode != 0) throw new Error(`CRASH(${proc.exitCode}): ${commandDetails}`);
6469
}
6570

6671
/** CLI flag maker: `toFlags({a: 1, b: 2})` yields `['-a=1', '-b=2']` */

0 commit comments

Comments
 (0)