diff --git a/spec/fixtures/module/fork_ping.js b/spec/fixtures/module/fork_ping.js new file mode 100644 index 000000000000..e6d3f921ba25 --- /dev/null +++ b/spec/fixtures/module/fork_ping.js @@ -0,0 +1,11 @@ +process.on('uncaughtException', function(error) { + process.send(error.stack); +}); + +var child = require('child_process').fork(__dirname + '/ping.js'); +process.on('message', function(msg) { + child.send(msg); +}); +child.on('message', function (msg) { + process.send(msg); +}); diff --git a/spec/node/child_process.coffee b/spec/node/child_process.coffee index 2246391b8c59..fdffb1058abb 100644 --- a/spec/node/child_process.coffee +++ b/spec/node/child_process.coffee @@ -12,3 +12,10 @@ describe 'child_process', -> assert.equal msg, 'message' done() child.send 'message' + + it 'should work in forked process', (done) -> + child = child_process.fork path.join(fixtures, 'module', 'fork_ping.js') + child.on 'message', (msg) -> + assert.equal msg, 'message' + done() + child.send 'message'