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

Trap SIGINT, SIGTERM, SIGHUP for autoclosing #107

Closed
1 task done
Mastercuber opened this issue Aug 16, 2023 · 0 comments · Fixed by #108
Closed
1 task done

Trap SIGINT, SIGTERM, SIGHUP for autoclosing #107

Mastercuber opened this issue Aug 16, 2023 · 0 comments · Fixed by #108

Comments

@Mastercuber
Copy link
Contributor

Mastercuber commented Aug 16, 2023

While developing, it is common to send signals to the process.

One example is opening a terminal and executing e.g. listhen -w index.ts. To be able to use the terminal again, the program must be interrupted with Ctrl + C which sends a SIGINT to the process.

While the program is running (listhen -w index.ts) in a terminal and the terminal gets closed, then a SIGHUP is send to the process.

And when a process is killed the default sent signal is SIGTERM.

When receiving one of these signals (INT/TERM/HUP) the process's exit event will not get fired, and so, also no cleanup (close()) will be executed.

To properly auto-close on these specific signals, it's enough to fire an exit event when a signal is trapped.

Additional information

  • Would you be willing to help implement this feature?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant