From 8e03ca12425f30bf9407b55b8a86be0419011e2f Mon Sep 17 00:00:00 2001 From: DABH Date: Wed, 26 Dec 2018 13:42:00 -0800 Subject: [PATCH] Add fixes from #1355 to unhandled rejection handler as well --- lib/winston/rejection-handler.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/winston/rejection-handler.js b/lib/winston/rejection-handler.js index 7e98dec0b..4d79685a8 100644 --- a/lib/winston/rejection-handler.js +++ b/lib/winston/rejection-handler.js @@ -207,8 +207,6 @@ module.exports = class RejectionHandler { asyncForEach( handlers, (handler, next) => { - // TODO: Change these to the correct WritableStream events so that we - // wait until exit. const done = once(next); const transport = handler.transport || handler; @@ -220,10 +218,11 @@ module.exports = class RejectionHandler { }; } - transport.once('logged', onDone('logged')); + transport._ending = true; + transport.once('finish', onDone('finished')); transport.once('error', onDone('error')); }, - gracefulExit + () => doExit && gracefulExit() ); this.logger.log(info);