feat: graceful shutdown via /api/shutdown

This commit is contained in:
zlm committed 2026-06-10 15:01:03 +08:00
1 parent 44e03d8e9a
commit 1e92cc85fe
2 files changed
+18 -5

No files matched your search

+7 -4
View File
@@ -39,10 +39,13 @@ function startBackend() {
function stopBackend() {
if (!backend) return
backend.kill('SIGTERM')
backend = null
isRunning = false
updateMenu()
try { require('http').get('http://localhost:3000/api/shutdown') } catch {}
setTimeout(() => {
try { backend.kill('SIGTERM') } catch {}
backend = null
isRunning = false
updateMenu()
}, 1000)
}
app.whenReady().then(() => {