mirror of
https://github.com/nodejs/node.git
synced 2024-11-22 15:47:56 +01:00
212466bea2
A child process created with .fork() needed to call `process.exit()` explicitly because the communication channel with the parent kept the event loop alive. Fix that by only ref'ing the channel when there are 'message' event listeners. Fixes #3799.
11 lines
234 B
JavaScript
11 lines
234 B
JavaScript
var assert = require('assert');
|
|
|
|
function onmessage(m) {
|
|
console.log('CHILD got message:', m);
|
|
assert.ok(m.hello);
|
|
process.removeListener('message', onmessage);
|
|
}
|
|
|
|
process.on('message', onmessage);
|
|
process.send({ foo: 'bar' });
|