mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-17 02:25:57 +00:00
feat: add different signal for sigterm and sigint (#390)
This commit is contained in:
@@ -118,7 +118,13 @@ export class Application {
|
||||
|
||||
// Immediate exit without graceful shutdown. Chromium may kill us on update/restart,
|
||||
// and we need to free the port instantly so the HTTP port doesn't keep switching.
|
||||
process.exit(EXIT_CODES.SUCCESS)
|
||||
// Exit 0 only for managed shutdowns (POST /shutdown from Chromium).
|
||||
// Signal kills exit non-zero so Chromium's OnProcessExited restarts us.
|
||||
const code =
|
||||
reason === 'SIGTERM' || reason === 'SIGINT'
|
||||
? EXIT_CODES.SIGNAL_KILL
|
||||
: EXIT_CODES.SUCCESS
|
||||
process.exit(code)
|
||||
}
|
||||
|
||||
private initCoreServices(): void {
|
||||
|
||||
@@ -16,6 +16,9 @@ export const EXIT_CODES = {
|
||||
|
||||
/** Port conflict after retries - Chromium should increment port and restart */
|
||||
PORT_CONFLICT: 2,
|
||||
|
||||
/** Killed by external signal - Chromium should restart */
|
||||
SIGNAL_KILL: 3,
|
||||
} as const
|
||||
|
||||
export type ExitCode = (typeof EXIT_CODES)[keyof typeof EXIT_CODES]
|
||||
|
||||
Reference in New Issue
Block a user