I want to terminate Gulp without any further action:
gulp.task('watch', function () {
gulp.watch('…', function quit (cb) {
// ... totally terminate gulp here, no cleanup required, drop to OS system prompt.
}
}
I tried throw new Error('ciao')
and that would quit the watch
but not the outer task
loop.
2
Answers
Not elegant, but what works is
process.exit(0);
You can use the process.exit() functionality, as