Skip to content

Instantly share code, notes, and snippets.

@mattpardee
Created May 10, 2012 18:48
Show Gist options
  • Save mattpardee/2655052 to your computer and use it in GitHub Desktop.
Save mattpardee/2655052 to your computer and use it in GitHub Desktop.
Possible spawn stdin problem
var spawn = require('child_process').spawn,
cs = spawn('/Users/mattpardee/Work/test/node_modules/coffee-script/bin/coffee', []);
cs.stdout.on('data', function (data) {
console.log('stdout: ' + data);
setInterval(function() {
console.log(cs.stdin.bytesWritten, cs.stdout.bytesRead);
cs.stdin.write('number = 42\n');
}, 1000);
});
cs.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
cs.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment