Currently I'm always getting "setsid: Operation not permitted".
Using child_process.spawn() doesn't use a pseudo terminal, so the shell goes into non-interactive mode.
Does anyone know how to do this properly?
Some examples of things I've tried: https://gist.github.com/5aceba736af5f7bb3946
Thanks,
Tom
Note that in interactive mode, you won't get streams for
stdin/out/err, since they're being consumed by the terminal. You
*can* do some tricky stuff like this, though:
// share the "real" stdin and stderr, but pipe stdout programmatically
var cp = child_process.spawn("/bin/bash", [], { customFds: [
stdio.stdinFD, -1, stdio.stderrFD ] })
cp.stdout.pipe(process.stdout)
> --
> You received this message because you are subscribed to the Google Groups "nodejs" group.
> To post to this group, send email to nod...@googlegroups.com.
> To unsubscribe from this group, send email to nodejs+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/nodejs?hl=en.
>
>
var cp = MAGIC_COMMAND_TO_SPAWN_BASH_INTERACTIVELY;
cp.stdout.on('data', function(data) {
process.stdout.write(data);
// or do other stuff
});
setTimeout(function() {
cp.stdin.write("tty\n");
}, 1000);
If I pass -1 for stdinFD in your second example the above example will print "not a tty" because it's not using a pseudo terminal. That's why I think I need to use tty.open, but I can't figure out the right incantation. Or it's just broken. I don't know which.
What am I doing wrong that's causing tty.open to always error out with "setsid: Operation not permitted"?
Thanks.