title: How to signal EOF to node.js stdin from console?
body: <p>I have a simple node.js app to echo stdin.  When I run it interactively on the Windows console, I expected control-Z to be recognised as an EOF signal.  But it isn't.  So how do I get a node app to treat control-Z as EOF?</p>
  
  <pre><code>// testEcho.js
  
  process.stdin.setEncoding('utf-8');
  console.log("input is a TTY?:",process.stdin.isTTY);
  
  process.stdin.on('readable',function() {
      var vText = process.stdin.read();
      if (vText != null)
          console.log('echo: "%s"',vText);
      process.stdout.write('&gt; '); // prompt for next
      });
  
  process.stdin.on('end',function() { // Works for redirected input but not triggered by ^Z on TTY
      console.log('end of input reached');
      });
  </code></pre>
  
  <p>```</p>