Created
March 24, 2012 09:54
-
-
Save gmiroshnykov/2180730 to your computer and use it in GitHub Desktop.
Spawn a child process and bind it to parent's stdin, stdout and stderr in node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var tty = require('tty'), | |
spawn = require('child_process').spawn; | |
var child = spawn('vim'); | |
child.stdout.pipe(process.stdout); | |
child.stderr.pipe(process.stderr); | |
process.stdin.pipe(child.stdin); | |
process.stdin.resume(); | |
tty.setRawMode(true); | |
child.on('exit', function(code, signal) { | |
process.stdin.pause(); | |
console.log(arguments); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@catdad I think it's because of this : tty.setRawMode(true); try something like package node-pty and will work fine - or more high level : cli-driver