Programmatically run command line process and respond to prompts with standard input in node.js

If I start a process in node.js to run the keytool command from JDK:

var exec = require('child_process').exec, child;
child = exec("/usr/java/bin/keytool -genkey -v -keystore my-release-key.keystore
-alias alias_name -keyalg RSA -keysize 2048 -validity 10000",
  function (error, stdout, stderr){
    console.log('stdout: ' + stdout);
    console.log('stderr: ' + stderr);
    if(error !== null){
      console.log('exec error: ' + error);
    }
});

When it would usually prompt me for the password that I want in the command line, how can you respond to that programmatically and continue the process?