Skip to content

Commit

Permalink
Set _rotate false on emit 'rotate' false (#2457)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
u8675309 authored Jul 27, 2024
1 parent d2859f3 commit 1719275
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions lib/winston/transports/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
Expand Down

0 comments on commit 1719275

Please sign in to comment.