gulpjs / glob-stream

Readable streamx interface over anymatch.
MIT License
178 stars 51 forks source link

fix: Avoid pushing additional paths to queue when error occurs #124

Closed phated closed 7 months ago

phated commented 7 months ago

As mentioned at https://github.com/gulpjs/glob-stream/pull/122#discussion_r1535802638, @joshhunt pointed out that additional paths would be pushed to the queue if a symlink error occurred.

Here, I've pulled in our now-and-later dependency to iterate over the dirents with an iterator that handle async operations. This allows us to avoid pushing more items into the queue if an error occurs in the symlink resolution.

I couldn't find a good way to write a unit test for this because we don't expose the walker and the stream won't emit more data events after it has been destroyed. However, I did verify the behavior using console.log statements and adding a file named z-test.txt to the symlink directory.