0

I use exec commands in Ubuntu very offten, I use it with promisify:

import { exec } from 'child_process'

const execFunction = promisify(exec)

Then when I run a command like:

await execFunction('sudo ufw status')

That command will ask me a password, the thing is I can't answer any question (like the question for the password) when using that command, so my question is: is there any way to pass an answer or something like that for the exec command?

Fabio Sousa
  • 261
  • 1
  • 2
  • 11
  • Please read https://stackoverflow.com/a/41343999/3592771 - exec returns a ChildProcess, and you can push values to the child process stdin – TBA Jan 09 '23 at 12:58

0 Answers0