weifuwu 0.16.5 → 0.16.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -123,12 +123,15 @@ function serve(handler, options) {
|
|
|
123
123
|
resolveReady = r;
|
|
124
124
|
});
|
|
125
125
|
if (options?.shutdown !== false) {
|
|
126
|
-
|
|
126
|
+
let shuttingDown = false;
|
|
127
|
+
const shutdown = () => {
|
|
128
|
+
if (shuttingDown) return;
|
|
129
|
+
shuttingDown = true;
|
|
127
130
|
server.close();
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
131
|
+
process.exit(0);
|
|
132
|
+
};
|
|
133
|
+
process.on("SIGTERM", shutdown);
|
|
134
|
+
process.on("SIGINT", shutdown);
|
|
132
135
|
}
|
|
133
136
|
if (options?.signal) {
|
|
134
137
|
if (options.signal.aborted) {
|