Skip to content

Commit

Permalink
fix: 馃悰 exit master process with after hook
Browse files Browse the repository at this point in the history
  • Loading branch information
wKich committed Sep 10, 2020
1 parent 0c99359 commit e90adfb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/server/master/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ function reportDataModule<T>(data: T): string {

export default async function (config: Config, options: Options): Promise<void> {
if (config.hooks.after) {
process.on('beforeExit', config.hooks.after);
// eslint-disable-next-line @typescript-eslint/no-misused-promises
process.on('beforeExit', async () => {
await config.hooks.after?.();
// eslint-disable-next-line no-process-exit
process.exit();
});
}
if (config.hooks.before) {
await config.hooks.before();
Expand Down

0 comments on commit e90adfb

Please sign in to comment.