question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gulp 4 returns with exit code 0 even if there are unfinished tasks

See original GitHub issue

What were you expecting to happen? Gulp 4 returns a non-zero exit code if tasks are unfinished

What actually happened? Gulp 4 returned exit code zero

Please post a sample of your gulpfile (preferably reduced to just the bit that’s not working)

const gulp = require('gulp')

gulp.task('aaa', () => {
  
})

When running the task gulp correctly reports that the task has not completed. But the return code of gulp seems to be 0. I would prefer it to be 1.

~/website$ node_modules/.bin/gulp aaa
[10:54:26] Using gulpfile ~/website/gulpfile.js
[10:54:26] Starting 'aaa'...
[10:54:26] The following tasks did not complete: aaa
[10:54:26] Did you forget to signal async completion?
~/website$ echo $?
0

What version of gulp are you using?

~/website$ gulp -v
[10:53:13] CLI version 1.4.0
[10:53:13] Local version 4.0.0-alpha.2

What versions of npm and node are you using?

~/website$ node -v
v8.9.3
~/website$ npm -v
5.5.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
aduh95commented, Jan 3, 2018

For the record, I tested with the latest version, and got the same result:

$ gulp -v                                                                                                                                               
[16:56:02] CLI version 2.0.0
[16:56:02] Local version 4.0.0
$ gulp aaa
[16:59:25] Using gulpfile .../gulpfile.js
[16:59:25] Starting 'aaa'...
[16:59:25] The following tasks did not complete: aaa
[16:59:25] Did you forget to signal async completion?
$ echo $?
0
1reaction
barbogastcommented, Jan 13, 2018

I just tried setting process.exitCode and it seemed to work for me. See the PR above.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gulp returns 0 when tasks fail - Stack Overflow
If gulp task gets a stream, it will listen to 'end' event and 'error' event. They corresponds to return code 0 and 1....
Read more >
Async Completion - gulp.js
When a stream, promise, event emitter, child process, or observable is returned from a task, the success or error informs gulp whether to...
Read more >
Hugo Will Not Rebuild Site after Syncing Gulp Changes
I'm working on a new site and am using NPM and Gulp to work with my SASS files. I'm using Hugo v0.29, Node...
Read more >
CoffeeScript
You might have noticed how even though we don't add return statements to CoffeeScript functions, they nonetheless return their final value.
Read more >
rollup.js
If an error occurs at either stage, it will return a Promise rejected ... incrementer.js export let count = 0; export function increment()...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found