Skip to content

Instantly share code, notes, and snippets.

@unbornchikken
Created July 18, 2017 06:45
Show Gist options
  • Save unbornchikken/298b6c507cea82a81074b801271f15d6 to your computer and use it in GitHub Desktop.
Save unbornchikken/298b6c507cea82a81074b801271f15d6 to your computer and use it in GitHub Desktop.
Repro case for Node.js issue #14325
'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