bin: add sigint listener for safer shutdown

This commit is contained in:
Mark Tyneway 2020-03-25 11:28:50 -07:00
parent 2807240f40
commit c9ea6aae43
No known key found for this signature in database
GPG key ID: D3CD8BD764ACE995
3 changed files with 12 additions and 0 deletions

View file

@ -46,6 +46,10 @@ process.on('unhandledRejection', (err, promise) => {
throw err;
});
process.on('SIGINT', async () => {
await node.close();
});
(async () => {
await node.ensure();
await node.open();

View file

@ -63,6 +63,10 @@ process.on('unhandledRejection', (err, promise) => {
throw err;
});
process.on('SIGINT', async () => {
await node.close();
});
(async () => {
await node.ensure();
await node.open();

View file

@ -38,6 +38,10 @@ process.on('unhandledRejection', (err, promise) => {
throw err;
});
process.on('SIGINT', async () => {
await node.close();
});
(async () => {
await node.ensure();
await node.open();