Skip to content

Instantly share code, notes, and snippets.

@sh1mmer
Created April 20, 2011 20:35
Show Gist options
  • Save sh1mmer/932771 to your computer and use it in GitHub Desktop.
Save sh1mmer/932771 to your computer and use it in GitHub Desktop.
var cp = require('child_process');
var child = cp.spawn('cat', [], {customFds:[0, 1, 2]});
child.stdout.on('data', function(d) {
console.log(d);
});
Enki:~ $ echo "foo" | node fds.js
node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
foo
TypeError: Cannot call method 'on' of null
at Object.<anonymous> (/Users/croucher/fds.js:3:14)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array.<anonymous> (module.js:423:10)
at EventEmitter._tickCallback (node.js:126:26)
Enki:~ $
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment