Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
how to use require('child_process').exec for a command that need user inputs?

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 ?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!