问题
I'm making a cli tool with Node.JS. I run another binary file from within node, and the other process asks for a password at some point.
So what I need is to simply launch the other process, and put it "in charge" of the terminal, so the other process handles the prompts and the console output.
回答1:
You can use 'inherit'
for the stdio option of spawn:
const spawn = require( 'child_process' ).spawn;
spawn( '/path/to/binary', [], { stdio: 'inherit' } );
来源:https://stackoverflow.com/questions/49737328/run-a-binary-from-node-js-and-relay-the-behavior-exactly-on-the-console-includi