title: How to run interactive shell command inside node.js?
body: <p>I have to run some interactive shell command inside node.js. Lets our interactive shell be <code>$ python</code>:</p>
  
  <pre><code>var cp = require('child_process');
  var pythonChildProcess = cp.spawn('python');
  
  pythonChildProcess.stdout.on("data", function(data) {
    console.log('data successfully written!', data); // never outputs anything
  });
  
  pythonChildProcess.stdin.write('1 + 1');
  pythonChildProcess.stdin.end();
  </code></pre>
  
  <p>This code does not output anything (but stdout should be <code>2</code>).</p>
  
  <p>But if it would, there will be another problem: how to make it interactive? The process ends when I call <code>pythonChildProcess.stdin.end();</code>! But I just wanted to end stdin and write next stdin!</p>
  
  <p>UPD:
  If I could emulate pressing of <code>enter</code> button - I would be able to interactively write to the process. But adding <code>\n</code> to the end of the input string does not help.</p>