From ee6fec7d10d1d74496ebc5c5bc38c24fa15c261b 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 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/winston/transports/file.js b/lib/winston/transports/file.js index 99682453b..fb2283b74 100644 --- a/lib/winston/transports/file.js +++ b/lib/winston/transports/file.js @@ -439,9 +439,8 @@ 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; } });