-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
I think this is the reason I didn't notice it fail. The build was using just spawn and so when rollup failed it didn't pass the exit status back out to the action so the action though the build succeeded.
- Loading branch information
Showing
3 changed files
with
20 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { spawn } from 'child_process'; | ||
|
||
const spawns = new Set(); | ||
|
||
export function spawnAndCheck(cmd, args, options) { | ||
const s = spawn(cmd, args, options); | ||
spawns.add(s); | ||
s.on('close', (code) => { | ||
spawns.delete(s); | ||
if (code !== 0) { | ||
console.error(cmd, 'exited with code:', code); | ||
[...spawns].forEach((s) => s.kill()); | ||
process.exit(code); | ||
} | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { spawn } from 'child_process'; | ||
import { mkdirSync } from 'fs'; | ||
import { spawnAndCheck } from '../lib/spawn.js'; | ||
|
||
mkdirSync('out', { recursive: true }); | ||
|
||
spawn('node', ['build/tools/copy.js'], { | ||
spawnAndCheck('node', ['build/tools/copy.js'], { | ||
shell: true, | ||
stdio: 'inherit', | ||
}); | ||
|
||
spawn('./node_modules/.bin/rollup', ['-c'], { | ||
spawnAndCheck('./node_modules/.bin/rollup', ['-c'], { | ||
shell: true, | ||
stdio: 'inherit', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters