title: Why doesn't my Node.js process terminate once all listeners have been removed?
body: <p>In the following code, I assign a listener to the <code>data</code> event of <code>process.stdin</code> with the <code>once</code> method.</p>
  
  <pre><code>console.log('Press Enter to allow process to terminate')
  process.stdin.once('data', callback)
  
  function callback (data) {
      console.log('Process can terminate now')
  }
  </code></pre>
  
  <p>In theory, when the callback has fired, the event listener should be automatically removed (because I attached it with <code>once</code>), allowing the process to terminate. Surprisingly, in this case, the process never terminates (The code you see is the whole thing, try it!). I also tried manually removing the listener, but that changes nothing.</p>
  
  <p>Is there something else going on here that I don't realise perhaps?</p>