Skip to content

Commit

Permalink
bin: add sigint listener for safer shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes committed Mar 25, 2020
1 parent 2807240 commit c9ea6aa
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bin/node
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions bin/spvnode
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions bin/wallet
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit c9ea6aa

Please sign in to comment.