@venturewild/workspace 0.1.6 → 0.1.7
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/package.json
CHANGED
|
@@ -710,12 +710,16 @@ async function main() {
|
|
|
710
710
|
} catch {}
|
|
711
711
|
}
|
|
712
712
|
|
|
713
|
+
// Hard safety net: even if stop() ever wedges, never leave the user staring at
|
|
714
|
+
// "shutting down…". Unref'd so the timer itself doesn't keep us alive.
|
|
715
|
+
const forceExitSoon = () => { setTimeout(() => process.exit(0), 3000).unref(); };
|
|
713
716
|
process.on('SIGINT', async () => {
|
|
714
717
|
console.log('\nshutting down…');
|
|
715
|
-
|
|
718
|
+
forceExitSoon();
|
|
719
|
+
try { await server.stop(); } catch {}
|
|
716
720
|
process.exit(0);
|
|
717
721
|
});
|
|
718
|
-
process.on('SIGTERM', async () => { await server.stop(); process.exit(0); });
|
|
722
|
+
process.on('SIGTERM', async () => { forceExitSoon(); try { await server.stop(); } catch {} process.exit(0); });
|
|
719
723
|
}
|
|
720
724
|
|
|
721
725
|
main().catch((err) => {
|
package/server/src/index.mjs
CHANGED
|
@@ -1328,7 +1328,14 @@ export async function createServer(overrides = {}) {
|
|
|
1328
1328
|
// The daemon is deliberately NOT stopped here — it is detached so sync
|
|
1329
1329
|
// keeps running after wild-workspace closes. `wild-workspace daemon
|
|
1330
1330
|
// stop` is the explicit off-switch.
|
|
1331
|
+
// Terminate live WebSockets first — wss.close() stops the server accepting
|
|
1332
|
+
// new connections but leaves existing client sockets open, and those keep
|
|
1333
|
+
// httpServer.close() hanging forever ("stuck shutting down" on Ctrl+C).
|
|
1334
|
+
try { wss.clients.forEach((c) => { try { c.terminate(); } catch {} }); } catch {}
|
|
1331
1335
|
try { wss.close(); } catch {}
|
|
1336
|
+
// Drop lingering keep-alive HTTP sockets too (Node 18.2+) so close resolves
|
|
1337
|
+
// promptly instead of waiting on idle browser connections.
|
|
1338
|
+
try { httpServer.closeAllConnections?.(); } catch {}
|
|
1332
1339
|
await new Promise((resolve) => httpServer.close(resolve));
|
|
1333
1340
|
},
|
|
1334
1341
|
};
|