I was wondering what if you call exec and the result of the call, which has
stdout, stdin, stderr.. you pipe to the current process stdout, stdin and
stderr:
var vi = exec("vi...
vi.stdout.pipe(process.stdout)
process.stdin.pipe(process.stdin)
vi.stderr.pipe(process.stderr)
Does this works? Why not?
El domingo, 8 de julio de 2012, Ben Noordhuis escribió:
> On Sun, Jul 8, 2012 at 11:54 AM, Antoine van Wel
> <[email protected] <javascript:;>> wrote:
> > Hi,
> >
> > I'm programming a small command-line application and want to open up
> > an external editor, and hand back control to node after the user exits
> > the editor. Tried opening up vi with child_process.exec and .spawn but
> > that did not quite do what I expected.
> >
> > 1 var exec = require("child_process").exec;
> > 2
> > 3 var child = exec("vi /tmp/test", function(error, stdout, stderr) {
> > 4 console.log("and we're back...");
> > 5 });
> >
> >
> > Any thoughts?
>
> I see you've solved your problem but - for the record and for the sake
> of posterity - the reason that this doesn't work is that vi is an
> interactive application (in other words, requires a terminal) while
> exec() and friends set up dumb pipes (think `cat | vi - | cat` - won't
> work).
>
> Look at e.g. pty.js[1] if you need full terminal support.
>
> [1] https://github.com/chjj/pty.js/
>
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to [email protected]<javascript:;>
> To unsubscribe from this group, send email to
> [email protected] <javascript:;>
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
--
Job Board: http://jobs.nodejs.org/
Posting guidelines:
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en