-
-
Save BigAB/703463f22c39cf19227dec2e72727bcf to your computer and use it in GitHub Desktop.
Infanticide Issue: child process lives after parent uncaught exception
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
const infanticide = require("infanticide"); | |
const { exec } = require("child_process"); | |
const child = exec(`sleep 5 && say "I am still going"`, { | |
cwd: process.cwd() | |
}); | |
child.stdout.pipe(process.stdout); | |
child.stderr.pipe(process.stderr); | |
infanticide(child); | |
setTimeout(() => { | |
throw Error("...aaaaaaaaand Snap, parent error!"); | |
}, 3000); |
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
{ | |
"name": "@bigab/infanticide-issue", | |
"version": "0.0.1", | |
"private": true, | |
"main": "index.js", | |
"scripts": { | |
"test": "node index.js" | |
}, | |
"dependencies": { | |
"infanticide": "^1.0.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment