spec: child_process.fork shouble be able to pipe stdio
authorCheng Zhao <zcbenz@gmail.com>
Tue, 31 May 2016 01:26:19 +0000 (10:26 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 31 May 2016 02:05:58 +0000 (11:05 +0900)
spec/fixtures/module/process-stdout.js [new file with mode: 0644]
spec/node-spec.js

diff --git a/spec/fixtures/module/process-stdout.js b/spec/fixtures/module/process-stdout.js
new file mode 100644 (file)
index 0000000..953750a
--- /dev/null
@@ -0,0 +1 @@
+process.stdout.write('pipes stdio')
index 71fdbac..93a247e 100644 (file)
@@ -76,6 +76,19 @@ describe('node feature', function () {
         })
         child.send('message')
       })
+
+      it('pipes stdio', function (done) {
+        let child = child_process.fork(path.join(fixtures, 'module', 'process-stdout.js'), {silent: true})
+        let data = ''
+        child.stdout.on('data', (chunk) => {
+          data += String(chunk)
+        })
+        child.on('exit', (code) => {
+          assert.equal(code, 0)
+          assert.equal(data, 'pipes stdio')
+          done()
+        })
+      })
     })
   })