Im trying to run a bash script through node.js with child_process
the part that is not working in my bash script when I am running the line
(echo "PASSWORD"; echo "PASSWORD"; echo "NAME"; echo "ORGANIZATION"; echo "ORGANIZATION"; echo "CIUDAD"; echo "REGION"; echo "PAIS"; echo "yes";echo) |keytool -genkey -v -keystore my-release-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000
Basically, I'm trying to answer different options when I'm running the keytool but its not working (the process is stuck waiting for an option)
In node I am running
exec('./script.sh', {
cwd: '/Users/MY/Directory'
}, (error, stdout, stderr) => {
if (error) {
console.error(`exec error: ${error}`);
return;
}
console.log(`stdout: ${stdout}`);
console.log(`stderr: ${stderr}`);
}).stderr.pipe(process.stderr);
Is there a solution for this?
Thanks