Skip to content

Commit 1719275

Browse files
authored
Set _rotate false on emit 'rotate' false (#2457)
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 d2859f3 commit 1719275

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

lib/winston/transports/file.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -439,9 +439,7 @@ 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')) {
445443
this._rotate = false;
446444
}
447445
});

0 commit comments

Comments
 (0)