Unverified Commit 12e88812 authored by Quentin's avatar Quentin Committed by GitHub

fix: handle string nodejs signals (#55606)

## Fixing a bug

### What?

On these versions, SIGINT signals are `string`, exit callback recieves code `number`

### How?

We use code argument to quit process for `event`, and exit with code `0` for `SIGINT` and `SIGTERM` signals 

Fixes #55605
Co-authored-by: 's avatarJiachi Liu <4800338+huozhi@users.noreply.github.com>
parent 7e17de98
......@@ -282,9 +282,10 @@ export async function startServer({
// This is the render worker, we keep the process alive
console.error(err)
}
process.on('exit', cleanup)
process.on('SIGINT', cleanup)
process.on('SIGTERM', cleanup)
process.on('exit', (code) => cleanup(code))
// callback value is signal string, exit with 0
process.on('SIGINT', () => cleanup(0))
process.on('SIGTERM', () => cleanup(0))
process.on('uncaughtException', exception)
process.on('unhandledRejection', exception)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment