Skip to content

Commit

Permalink
Set _rotate false on emit 'rotate' false
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 May 3, 2024
1 parent 1d5d527 commit ee6fec7
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/winston/transports/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
});
Expand Down

0 comments on commit ee6fec7

Please sign in to comment.