Skip to content

"end" emitted prematurely and twice for paused last line #1

@dertseha

Description

@dertseha

When pausing the "line" events after each line (and resuming asynchronously), the "end" event is fired while still processing the last line; After resuming, "end" is emitted a second time.

I made a quick look into LineByLineReader.prototype._nextLine and modified the sequence for me. It works for my case, but can't tell whether all are covered:

  • comment out the if (this._end) block at line 91+
  • modify check for empty _lines at 100 to read:
    if (this._lines.length === 0) {
        if (this._end) {
            this.emit('end');
        } else {
            this._readStream.resume();
        }
        return;
    }

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions