mirror of
https://github.com/pockethost/pockethost.git
synced 2026-03-02 15:03:26 +00:00
12 lines
323 B
TypeScript
12 lines
323 B
TypeScript
import exitHook, { asyncExitHook as _, gracefulExit as __ } from 'exit-hook'
|
|
|
|
export const asyncExitHook = (cb: () => Promise<void>) => _(cb, { wait: 5000 })
|
|
|
|
export const gracefulExit = async (signal?: number) => {
|
|
__(signal)
|
|
await new Promise((resolve) => {
|
|
process.on('exit', resolve)
|
|
})
|
|
}
|
|
export { exitHook }
|