mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +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' });
|