]> khamidou — GitHub mirrors - electron.git/commitdiff
Add test case for #83.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 5 Sep 2013 01:21:39 +0000 (09:21 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 5 Sep 2013 01:21:39 +0000 (09:21 +0800)
spec/fixtures/module/fork_ping.js [new file with mode: 0644]
spec/node/child_process.coffee

diff --git a/spec/fixtures/module/fork_ping.js b/spec/fixtures/module/fork_ping.js
new file mode 100644 (file)
index 0000000..e6d3f92
--- /dev/null
@@ -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);
+});
index 2246391b8c59b72c1fd2aa4913ea2f415d79fad8..fdffb1058abb29d6c75d6a2aba9a908b32f3b6b4 100644 (file)
@@ -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'