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

feat: trap SIGINT, SIGTERM and SIGHUP for autoclosing #108

Merged
merged 5 commits into from
Sep 8, 2023

Conversation

Mastercuber
Copy link
Contributor

πŸ”— Linked issue

Closes #107

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme, or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

For proper auto-closing when sending signals (SIGINT/SIGTERM/SIGHUP) to the process - e.g. while developing - this PR adds traps for these 3 signals and manually triggers the auto-closing by firing an exit event.

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

also make clear, that `exit` is an node.js event
@codecov
Copy link

codecov bot commented Aug 16, 2023

Codecov Report

Merging #108 (2dc1174) into main (78dd4b7) will increase coverage by 0.11%.
The diff coverage is 100.00%.

❗ Current head 2dc1174 differs from pull request most recent head b871471. Consider uploading reports for the commit b871471 to get more accurate results

@@            Coverage Diff             @@
##             main     #108      +/-   ##
==========================================
+ Coverage   57.90%   58.01%   +0.11%     
==========================================
  Files          12       12              
  Lines        1487     1491       +4     
  Branches      138      138              
==========================================
+ Hits          861      865       +4     
  Misses        626      626              
Files Changed Coverage Ξ”
src/listen.ts 82.77% <100.00%> (+0.23%) ⬆️

@Mastercuber Mastercuber changed the title chore: catch SIGINT, SIGTERM, SIGHUP for autoclosing chore: trap SIGINT, SIGTERM, SIGHUP for autoclosing Aug 16, 2023
@pi0 pi0 changed the title chore: trap SIGINT, SIGTERM, SIGHUP for autoclosing feat: trap SIGINT, SIGTERM and SIGHUP for autoclosing Aug 23, 2023
@pi0
Copy link
Member

pi0 commented Sep 8, 2023

Thanks for this PR dear @Mastercuber sorry it took long.

@pi0 pi0 merged commit 1594d0f into unjs:main Sep 8, 2023
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 this pull request may close these issues.

Trap SIGINT, SIGTERM, SIGHUP for autoclosing
2 participants