ngrok / ngrok-javascript

Embed ngrok secure ingress into your Node.js apps with a single line of code.
https://ngrok.com
Apache License 2.0
94 stars 18 forks source link

add SIGINT handler to listen for clean shutdown #9

Closed bobzilladev closed 1 year ago

jrobsonchase commented 1 year ago

What happens if we don't do this?

My concern is that a user might want to handle SIGINT differently and not shut down right away, but then we've already invalidated their tunnel.

bobzilladev commented 1 year ago

My concern is that a user might want to handle SIGINT differently and not shut down right away, but then we've already invalidated their tunnel.

Good point, I've pushed a change that defers to a user's handler if they've registered one. This is also just part of the listen helper function, so if a user does a full session+tunnel configuration it wouldn't exist.