joyent/node — Issue #1899: On windows, if you spawn a child process, it raises an exception when outputting anything
Author: kuchumovn
Created: 2011-10-16 22:43:44+00:00
State: open

Try to run this example on Node 0.5.9:

node parent

parent.js:

console.log('hello from parent')

var process = require('child_process').spawn("node", ["child.js"])

process.stdout.addListener('data', function (data) {
require('sys').print(data)
process.stdout.write(data)
})

// Error: write EINVAL
process.stderr.addListener('data', function (data) {
require('sys').print(data)
})

child.js:

console.log('hello from child')

The child process crashes with "Error: write EINVAL" exception.