Skip to content

Stream doesn't end when using fn as condition. #61

@bfricka

Description

@bfricka

When I use a function as condition, stream never ends. An example probably works best.

In this case, everything ends up in dist, and stream ends.

gulp.task('copy', function() {
  return gulp
    .src('path/to/stuff')
    .pipe(gulpif(false, fail())
    .pipe(gulp.dest('dist');
});

So in console you see:

Staring 'copy'...
Finished 'copy' after 4ms

In the function case everything still ends up in dist, but stream doesn't end.

function returnfalse() { return false }
gulp.task('copy', function() {
  return gulp
    .src('path/to/stuff')
    .pipe(gulpif(returnfalse, fail())
    .pipe(gulp.dest('dist');
});

In console you see:

Starting 'copy'...
[process exits]

Obviously this is an issue because we need the stream to end for other tasks to know it completed (it can't be a dependency task otherwise).

Am I doing something wrong? It seems like these cases should behave identically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions