|
1 | 1 | import { INestApplicationContext, Logger, LoggerService } from '@nestjs/common'; |
2 | 2 | import { Type } from '@nestjs/common/interfaces/type.interface'; |
| 3 | +import { SHUTDOWN_SIGNALS } from './constants'; |
3 | 4 | import { UnknownModuleException } from './errors/exceptions/unknown-module.exception'; |
4 | | -import { NestContainer } from './injector/container'; |
5 | | -import { ContainerScanner } from './injector/container-scanner'; |
6 | | -import { Module } from './injector/module'; |
7 | | -import { ModuleTokenFactory } from './injector/module-token-factory'; |
8 | 5 | import { |
9 | | - callModuleInitHook, |
| 6 | + callAppShutdownHook, |
10 | 7 | callModuleBootstrapHook, |
11 | 8 | callModuleDestroyHook, |
12 | | - callAppShutdownHook, |
| 9 | + callModuleInitHook, |
13 | 10 | } from './hooks'; |
14 | | -import { SHUTDOWN_SIGNALS } from './constants'; |
| 11 | +import { NestContainer } from './injector/container'; |
| 12 | +import { ContainerScanner } from './injector/container-scanner'; |
| 13 | +import { Module } from './injector/module'; |
| 14 | +import { ModuleTokenFactory } from './injector/module-token-factory'; |
15 | 15 |
|
16 | 16 | export class NestApplicationContext implements INestApplicationContext { |
17 | 17 | private readonly moduleTokenFactory = new ModuleTokenFactory(); |
@@ -74,9 +74,10 @@ export class NestApplicationContext implements INestApplicationContext { |
74 | 74 |
|
75 | 75 | protected listenToShutdownSignals() { |
76 | 76 | SHUTDOWN_SIGNALS.forEach((signal: any) => |
77 | | - process.on(signal, async () => { |
| 77 | + process.on(signal, async code => { |
78 | 78 | await this.callDestroyHook(); |
79 | 79 | await this.callShutdownHook(signal); |
| 80 | + process.exit(code || 1); |
80 | 81 | }), |
81 | 82 | ); |
82 | 83 | } |
|
0 commit comments