Skip to content

Commit ee6fec7

Browse files
authored
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.
1 parent 1d5d527 commit ee6fec7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/winston/transports/file.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,8 @@ module.exports = class File extends TransportStream {
439439
this._dest = this._createStream(this._stream);
440440
this._opening = false;
441441
this.once('open', () => {
442-
if (this._stream.eventNames().includes('rotate')) {
443-
this._stream.emit('rotate');
444-
} else {
442+
if (!this._stream.emit('rotate'))
443+
{
445444
this._rotate = false;
446445
}
447446
});

0 commit comments

Comments
 (0)