Skip to content

Commit

Permalink
fix: remove SIGUSR2 to support --heapsnapshot-signal=SIGUSR2 node opt…
Browse files Browse the repository at this point in the history
…ions flag
  • Loading branch information
titanism committed Jun 29, 2024
1 parent a11ef41 commit 70bad4a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 4 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ Using this package will bind process event listeners when `graceful.listen()` is
* `process.once('SIGTERM')` - will exit gracefully
* `process.once('SIGHUP')` - will exit gracefully
* `process.once('SIGINT')` - will exit gracefully
* `process.once('SIGUSR2')` - will exit gracefully (nodemon support)

This package also prevents multiple process/SIG events from triggering multiple graceful exits. Only one graceful exit can occur at a time.

Expand Down
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ class Graceful {
});

// handle graceful restarts
// support nodemon (SIGUSR2 as well)
// <https://github.com/remy/nodemon#controlling-shutdown-of-your-script>
for (const sig of ['SIGTERM', 'SIGHUP', 'SIGINT', 'SIGUSR2']) {
for (const sig of ['SIGTERM', 'SIGHUP', 'SIGINT']) {
process.once(sig, async () => {
await this.exit(sig);
});
Expand Down

0 comments on commit 70bad4a

Please sign in to comment.