|
|
@ -1,4 +1,4 @@ |
|
|
|
|
|
|
|
import * as config from '../config'; |
|
|
|
|
|
|
|
|
|
|
|
var exitHandlers: (() => void)[] = []; |
|
|
|
var exitHandlers: (() => void)[] = []; |
|
|
|
var exitHandled = false; |
|
|
|
var exitHandled = false; |
|
|
@ -18,9 +18,16 @@ function exitHandler(options: any, err?: any) { |
|
|
|
} |
|
|
|
} |
|
|
|
exitHandled = true; |
|
|
|
exitHandled = true; |
|
|
|
for(let i = 0; i < exitHandlers.length; i++) { |
|
|
|
for(let i = 0; i < exitHandlers.length; i++) { |
|
|
|
|
|
|
|
try { |
|
|
|
exitHandlers[i](); |
|
|
|
exitHandlers[i](); |
|
|
|
|
|
|
|
} catch(e) { |
|
|
|
|
|
|
|
console.error('Got error during exit: ' + e); |
|
|
|
|
|
|
|
if(!config.PRODUCTION_MODE && e instanceof Error) { |
|
|
|
|
|
|
|
console.error(e.stack); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
console.log('process exit'); |
|
|
|
console.log('process exited successfully'); |
|
|
|
process.exit(); |
|
|
|
process.exit(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|