title: Capture input in the child process after spawn in node
body: <p>I'm working on a small cli tool that can automatically deploy Google Home actions based on the projects that are setup in a directory.</p>
  
  <p>Basically my script checks the directories and then asks which project to deploy. The actual command that should run is coming from Google's cli <a href="https://developers.google.com/actions/tools/gactions-cli" rel="nofollow noreferrer">gactions</a></p>
  
  <p>To run it with arguments I setup a spawned process in my node-script:</p>
  
  <pre><code>const { spawn } = require('child_process')
  const child = spawn('./gactions', [
      'update',
      '--action-package',
      '&lt;PATH-TO-PACKAGE&gt;',
      '--project',
      '&lt;PROJECT-NAME&gt;'
  ])
  
  child.stdout.on('data', data =&gt; {
      console.log(data)
  }
  </code></pre>
  
  <p>However, the first time a project is deployed, the gactions cli will prompt for an authorization code. Running the code above, I can actually see the prompt, but the script won't proceed when actually entering that code.</p>
  
  <p>I guess there must be some way in the child process to capture that input? Or isn't this possible at all? </p>