npm / fstream

Advanced FS Streaming for Node
ISC License
208 stars 43 forks source link

make collect() respect stream pause/resume state #53

Closed rvagg closed 8 years ago

rvagg commented 8 years ago

Explained in commit message:

Without watching if a stream is already paused before calling pause(), collect() can conflict with other users of the stream who may be managing state, resulting in a premature collect(). This manifests in the fstream-npm and node-tar combination where fstream-npm manages state in readBundledLinks() at the same time collect() is processing the stream. collect() ends up running before fstream-npm has properly set up the correct list of entries according to the ignore rules. When collect() gets to run before this is complete, fstream starts performing _read() operations on a non-filtered list, keeping track of entry index, then after it starts, fstream-npm inserts a new list of entries and the entry index is incorrect and can skip files.

SimenB commented 8 years ago

1 line of code. GG good sir!

othiym23 commented 8 years ago

Landed as a67b90b33a1f862f9593e28311b57c09a3b191be and 24c2ad5a46c15e624ab282b03a509de0353870bf, released as fstream@1.0.10. Thanks a ton, Rod!