Browse Source

Add failing spec for fork --eval message bug

Kevin Sawicki 8 years ago
parent
commit
7f28b7a151
1 changed files with 10 additions and 0 deletions
  1. 10 0
      spec/node-spec.js

+ 10 - 0
spec/node-spec.js

@@ -91,6 +91,16 @@ describe('node feature', function () {
           done()
         })
       })
+
+      it('works when sending message to a forked process using the --eval argument', function (done) {
+        const source = "process.on('message', function (msg) { process.send(msg) })"
+        const forked = ChildProcess.fork('--eval', [source])
+        forked.on('message', (message) => {
+          assert.equal(message, 'hello')
+          done()
+        })
+        forked.send('hello')
+      })
     })
 
     describe('child_process.spawn', function () {