title: Result of ps au | grep ssh different in Node.js (using spawn/pipe) vs shell
body: <p>I'm playing around with node streams and child processes. So I want to emulate next shell command with pipes:</p>
  
  <pre><code>ps au | grep ssh
  </code></pre>
  
  <p>So I wrote next code:</p>
  
  <pre><code>var spawn = require('child_process').spawn;
  var ps    = spawn('ps',   ['au']);
  var grep  = spawn('grep', ['ssh']);
  
  ps.stdout.pipe(grep.stdin);
  
  grep.stdout.on('data', function(data) { console.log(data) });
  </code></pre>
  
  <p>Then I run it, but nothing happens. What did I do wrong?</p>
  
  <p>P.S. - I know about: </p>
  
  <pre><code>require('child_process')
     .exec('ps au | grep ssh', function(err, stdout, stderr) { 
         ... 
     }). 
  </code></pre>
  
  <p>I'm just playing around with Node.js, and I want to understand what's wrong with this example.</p>
  
  <p><strong>Update 1:</strong><br>
  It appeared that with grep <code>bash</code> program works as expected, but with grep <code>ssh</code> there is no result. Although <code>ps au | grep ssh</code> gives me this result: </p>
  
  <pre><code>vagrant 11681 0.0 0.1 10464 916 pts/0 S+ 07:54 0:00 grep --color=auto ssh.
  </code></pre>