node-cmd
node-cmd copied to clipboard
answering to a CMD y/n prompt
hello
i was using this library and its quite good
but unfortunately the command im using prompts me to accept or deny via y/n
i was wondering if the library allows me to answer to this prompt if it is possible can you provide me with a sample code ,all i found is retrieving the process id is there a way to reconnect and answer y to the process ?
i already tried this
const syncDir=cmd.run('cd ../tools/ && ffmpeg -i input.mkv -t 10 test3.mkv' ,function(err, data, stderr){ console.log('running'); console.log('data ',data); console.log('stderr ',stderr); console.log('err ',err); if ( stderr.includes('already exists. Overwrite ? [y/N]')) { data.stdin.write("y"); console.log('accepting '); } });
but i couldn't make it work if its not possible i can work around it but i wanted to check with you guys beforehand
You should just be able to send the commands over the line. the pipe is open. Sorry for the delay in response. I'll do my best to help out if you are still having troubles.
Also, I think the Python Shell example might be helpful