Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Oct 18, 2024
1 parent 9393a3c commit 446bb4e
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions build/tools/serve.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ import { mkdirSync } from 'fs';

mkdirSync('out', { recursive: true });

const spawns = [];
const spawns = new Set();

function spawnAndCheck(cmd, args, options) {
const s = spawn(cmd, args, options);
spawns.push(s);
spawns.add(s);
s.on('close', (code) => {
console.log(cmd, 'exited with code:', code);
spawns.forEach((s) => s.kill());
process.exit(code);
spawns.delete(s);
if (code !== 0) {
console.error(cmd, 'exited with code:', code);
[...spawns].forEach((s) => s.kill());
process.exit(code);
}
});
}

Expand Down

0 comments on commit 446bb4e

Please sign in to comment.