From 60743918542dc7831b3d0f09029bd558df2e658e Mon Sep 17 00:00:00 2001 From: u8675309 <58795251+u8675309@users.noreply.github.com> Date: Fri, 3 May 2024 15:18:44 -0600 Subject: [PATCH] Set _rotate false on emit 'rotate' false 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; } });