title: Why does this simple nodejs programm with promises run forever?
body: <p>I am running a rather simple nodejs program, which fetches some rows from a mssql database, does something with them, and then should exit.</p>
  
  <p>Instead, it does what it is supposed to do, but then keeps running forever.</p>
  
  <p>Did I forget anything to allow the program to finish?</p>
  
  <p>Or is it simply that my expectation that the program will exit when all promises have been fulfilled is wrong, and I need to terminate it manually?</p>
  
  <pre><code>'use strict';
  var mssql = require('mssql');
  
  var myssqlConfig = {
      user: '...',
      password: '...',
      server: '...',
      port: 1435,
      database: '...'
  };
  
  mssql.connect(myssqlConfig).then(function() {
  
      new mssql.Request()
      .input('someRow', mssql.VarChar(), 'someValue')
      .query("SELECT * FROM tableName WHERE someColumn &gt; @someValue")
      .then(function(recordset){
              // do non-relevant stuff with the record set.
      })
      .catch(function(err){
          console.log('Error: '+err);
      });
  }).catch(function(err) {
       console.log('Connection Error: '+err);
  });
  </code></pre>