On 21 September 2012 12:40, James Coglan <[email protected]> wrote:

> I'd like to have my command-line Node program invoke another interactive
> shell program (in this case w3m, but think vim, less, and so on) as a child
> process so that it appears in my terminal. I thought I could do that like
> this:
>
> require('child_process').execFile('w3m', ['http://www.google.com'],
> {stdio: 'inherit'})
>
> But it turns out that doesn't work. Is this possible?
>

This is a bit better in that it displays the output from w3m, but it's not
color formatted (I guess because its stdin is not a tty) and I can't
interact with it properly:

var cp  = require('child_process'),
    w3m = cp.execFile('w3m', ['http://www.google.com']);

process.stdin.pipe(w3m.stdin);
w3m.stdout.pipe(process.stdout);

So I need to make w3m know it's writing to a tty, and forward every
keystroke from Node to the child process. I tried
process.stdin.setRawMode(true) but this just locked the process up and
CTRL-C and CTRL-Z did not work.

-- 
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

Reply via email to