Created
July 18, 2017 06:45
-
-
Save unbornchikken/298b6c507cea82a81074b801271f15d6 to your computer and use it in GitHub Desktop.
Repro case for Node.js issue #14325
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
'use strict'; | |
const { fork } = require('child_process'); | |
if (process.send) { | |
child(); | |
} | |
else { | |
parent(); | |
} | |
function parent() { | |
console.log('Parent started.'); | |
const forked = fork('repro.js'); | |
forked.on('exit', code => console.log('Forked child exit, code:', code)); | |
forked.on('error', err => console.log('Forked child error:', err.stack)); | |
forked.on('close', () => console.log('Forked child close.')); | |
} | |
function child() { | |
console.log('Child started.'); | |
setTimeout( | |
() => { | |
console.log('Child is about to close.'); | |
}, | |
1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment