Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix signal handling #1460

Merged
merged 1 commit into from
Jun 13, 2024
Merged

fix signal handling #1460

merged 1 commit into from
Jun 13, 2024

Conversation

mbostock
Copy link
Member

Fixes #1459. The main things here are:

  • Don’t try to record another signal if we’re already exiting
  • Use process.kill instead of process.exit to ensure equivalence with default handler
  • (Which requires using process.off to remove our handler before killing)

I also used Promise.race to simplify the code slightly.

@mbostock mbostock requested a review from visnup June 13, 2024 16:32
@mbostock mbostock enabled auto-merge (squash) June 13, 2024 16:43
Copy link
Member

@visnup visnup left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally in terminal with INT, HUP, and TERM and matches previous behavior. Thanks!

@mbostock mbostock merged commit 44c5be9 into main Jun 13, 2024
4 checks passed
@mbostock mbostock deleted the mbostock/fix-signal-kill branch June 13, 2024 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants