documentationjs/gulp-documentation

Stream is not ended.

drinchev opened this issue · 2 comments

Hey there,

I was having problems when I'm using gulp documentation.

The stream seems to not terminate which breaks gulp flow.

gulp.task('gdocs', function () {
    return gulp.src('./any.js')
        .pipe(documentation({ format: 'md' }))
        .pipe(gulp.dest('md-documentation'));
});

which gives the following output :

$ gulp gdocs
[12:59:43] Using gulpfile /Volumes/Media/Projects/Gulpfile.js
[12:59:43] Starting 'gdocs'...
$ 

The problem I identified is on Line 37 that needs to have assigned callback. It should look like this :

return through2.obj(function document(file, enc, cb) {
   /* ... */
  }, function (callback) {
    /* ... */  
    .pipe(concat(function (output) {
       /* ... */
      cb();
    }));
  });

This seems to fix the problem and the callback is properly called when the stream flushes itself.

tmcw commented

@drinchev any chance you can roll a pull request implementing this change?

@tmcw will do this week