It currently listens to the finish event on the stream returned by gulp-install. As far as I can see, gulp-install returns a transform (through) stream, which is both a writable and readable stream. The finish event comes from the Writable stream, that is, it is fired as soon as buffers have finished being piped into the through stream.
I believe you'd rather wait until gulp-install's readable stream output ends (that is, when you call through2's flushFunction's callback).
I believe a valid fix would be:
.pipe(install())
.on('end', function() {
// ... do stuff ...
done(); // the gulp task's callback
})
.resume(); // Readable streams start and stay paused in Node >= 0.10 unless calling resume()
// or attaching a data listener
I believe the sample slushfile has an issue.
It currently listens to the
finish
event on the stream returned bygulp-install
. As far as I can see, gulp-install returns a transform (through) stream, which is both a writable and readable stream. Thefinish
event comes from the Writable stream, that is, it is fired as soon as buffers have finished being piped into the through stream.I believe you'd rather wait until gulp-install's readable stream output
end
s (that is, when you call through2's flushFunction's callback).I believe a valid fix would be: