sails lowers without process.exit - feature or mistake?
<p>My sails.js app is running under PM2, and I'd like PM2 to be able to restart the app, which it does in the case of a crash. The thing is, when sails fails to load a hook, for instance, if a DB is not available at startup, then the graceful <code>sails.lower()</code> is called internally by sails, but the actual node process does not exit (no <code>process.exit()</code> is called after the lowering) by the core sails code. This has the result of PM2 not knowing that sails has shutdown, and therefore not starting it back up again. </p>

<p>This all happens in the initial bootstrapping of the app, and is before any of my code is called, so I have no control over it. </p>

<p>Does anybody have any suggestions of how I may solve this?</p>

<p>I'm thinking I could write a custom core hook that could hook into the <code>sail.on('lowered', fn)</code> and call a <code>process.exit()</code> on receiving that event. Ideas?</p>

<p>Many thanks.</p>