gornostay25 / svelte-adapter-bun

A SvelteKit adapter for Bun
MIT License
537 stars 34 forks source link

feat: handle SIGINT/SIGTERM #69

Open AmrSaber opened 1 month ago

AmrSaber commented 1 month ago

Handles system exit signals and closes the server gracefully.

Resolves #52

I remove the callback from the listeners as -by experience- the callback sometimes needlessly gets called several times if not removed after first call.

AmrSaber commented 1 month ago

I have added await on server.stop() as it returns a promise in Bun 1.1.30. This is also backwards compatible with older versions as await is a no-op for normal functions.