runPromptWithAnswers = (location, args, answers) => {
  const process = runAndGetProcess(location, args);

  process.stdin.setDefaultEncoding("utf-8");

  const delay = 2000;
  let outputTimeout;
  let currentAnswer = 0;

  const writeAnswer = (output) => {
    if (!answers) {
      process.stdin.write(output);
      processKill(process);

      return;
    }

    if (currentAnswer < answers.length) {
      process.stdin.write(answers[currentAnswer]);
      currentAnswer++;
    }
  };

  process.stdout.pipe(
    new Writable({
      write(chunk, encoding, callback) {
        const output = chunk.toString("utf8");

        if (output) {
          if (outputTimeout) {
            clearTimeout(outputTimeout);
          }

          // we must receive new stdout, then have 2 seconds
          // without any stdout before writing the next answer
          outputTimeout = setTimeout(() => {
            writeAnswer(output);
          }, delay);
        }

        callback();
      },
    }),
  );

  return new Promise((resolve) => {
    const obj = {};

    let stdoutDone = false;
    let stderrDone = false;

    const complete = () => {
      if (outputTimeout) {
        clearTimeout(outputTimeout);
      }

      if (stdoutDone && stderrDone) {
        processKill(process);
        resolve(obj);
      }
    };

    process.stdout.pipe(
      concat((result) => {
        stdoutDone = true;
        obj.stdout = result.toString();

        complete();
      }),
    );

    process.stderr.pipe(
      concat((result) => {
        stderrDone = true;
        obj.stderr = result.toString();

        complete();
      }),
    );
  });
}
runPromptWithAnswers
@param {string} location location of current working directory
@param {string[]} args CLI args to pass in
@param {string[]} answers answers to be passed to stdout for inquirer question