fix: unlisten for interrupts earlier

This commit is contained in:
Andy Burke 2025-07-23 17:00:15 -07:00
parent cb630a095b
commit 4f2ea38222
2 changed files with 2 additions and 2 deletions

View file

@ -1,7 +1,7 @@
{
"name": "@andyburke/serverus",
"description": "A flexible HTTP server for mixed content. Throw static files, markdown, Typescript and (hopefully, eventually) more into a directory and serverus can serve it up a bit more like old-school CGI.",
"version": "0.9.4",
"version": "0.9.5",
"license": "MIT",
"exports": {
".": "./serverus.ts",

View file

@ -196,11 +196,11 @@ export class SERVER {
*/
public async stop(): Promise<void> {
if (this.server) {
this.controller?.abort();
if (this.shutdown_binding) {
Deno.removeSignalListener('SIGTERM', this.shutdown_binding);
Deno.removeSignalListener('SIGINT', this.shutdown_binding);
}
this.controller?.abort();
await this.server.shutdown();
}