Skip to content

Commit

Permalink
chore: errexit
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken committed May 23, 2024
1 parent 16e93bc commit 2222c84
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions .github/scripts/libmongocrypt.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,16 @@ async function parseArguments() {

/** `xtrace` style command runner, uses spawn so that stdio is inherited */
async function run(command, args = [], options = {}) {
console.error(`+ ${command} ${args.join(' ')}`, options.cwd ? `(in: ${options.cwd})` : '');
await events.once(
child_process.spawn(command, args, { stdio: 'inherit', cwd: resolveRoot('.'), ...options }),
'exit'
);
const commandDetails = `+ ${command} ${args.join(' ')}${options.cwd ? ` (in: ${options.cwd})` : ''}`;
console.error(commandDetails);
const proc = child_process.spawn(command, args, {
stdio: 'inherit',
cwd: resolveRoot('.'),
...options
});
await events.once(proc, 'exit');

if (proc.exitCode != 0) throw new Error(`CRASH(${proc.exitCode}): ${commandDetails}`);
}

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

0 comments on commit 2222c84

Please sign in to comment.