I am doing a CLI and want to use "aws configure", that command asks to user 4 things:
AWS Access Key ID [****************]:
AWS Secret Access Key [****************]:
Default region name [sa-east-1]:
Default output format [json]:
but when i use on require('child_process').exec("aws configure"), it stop without answer and user cant input...
i already tried with spawn... but its didnt work... like:
const { spawn } = require('child_process');
const ls = spawn('aws', ['configure']);
ls.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
ls.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
ls.on('close', (code) => {
console.log(`child process exited with code ${code}`);
});
--- UPDATE --- I get same answers! I am using now SpawnSync with stdio: "inherit", its work! But i have the four answers inputs! How i can pass then without need user answer ?