I have a problem where I run a script in NodeJs, in this script I have an exec function which calls a CLI program, that CLI program requires two other answers after that command, but I don't know how I can answer this when I exec this from child_process so the command will be forever waiting for these answers.
Here is an example, just keep in mind where I have the command npm init, it will be the CLI program I am using instead, I know with npm I could pass some flag like -y and it will work for the answers, but I don't have this feature in the CLI program:
import { exec } from 'child_process';
import { promisify } from 'util';
const execFunction = promisify(exec);
const { stdout } = await execFunction(`npm init`);
console.log('stdout', stdout);