feat(cli): add graceful shutdown with OS signal handlers

This commit is contained in:
yiling
2026-05-24 00:03:21 +08:00
parent 6a2cb2c8c5
commit 823d915613
+10
View File
@@ -105,4 +105,14 @@ export async function run() {
})
console.log(`🚀 Server running at ${server.url}`)
const shutdown = () => {
console.log('\nShutting down gracefully...')
assetService.stopCleanupJob()
server.stop(true)
process.exit(0)
}
process.on('SIGINT', shutdown)
process.on('SIGTERM', shutdown)
}