From 17192754733c40d261d76b690d84d4d2608c05f1 Mon Sep 17 00:00:00 2001 From: u8675309 <58795251+u8675309@users.noreply.github.com> Date: Sat, 27 Jul 2024 05:50:34 -0600 Subject: [PATCH] Set _rotate false on emit 'rotate' false (#2457) In some situations the event names includes events with no more listeners. Check the emit return code to see whether it was received instead of checking event names. --- lib/winston/transports/file.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/winston/transports/file.js b/lib/winston/transports/file.js index 99682453b..a6ee2db85 100644 --- a/lib/winston/transports/file.js +++ b/lib/winston/transports/file.js @@ -439,9 +439,7 @@ module.exports = class File extends TransportStream { this._dest = this._createStream(this._stream); this._opening = false; this.once('open', () => { - if (this._stream.eventNames().includes('rotate')) { - this._stream.emit('rotate'); - } else { + if (!this._stream.emit('rotate')) { this._rotate = false; } });