From 718d2ae2eeac546c9b8e897a621909e11bc8bcf7 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 12 May 2015 21:19:59 -0700 Subject: [PATCH] build(gulp): run beforeExit hook only once this prevents inifinite loops when cleanup task registers an additional task, that triggers a new beforeExit event Fixes #1833 --- gulpfile.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gulpfile.js b/gulpfile.js index a7fccd0ee1..e1eae6eb0c 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -832,6 +832,11 @@ process.on('SIGINT', function() { }); // register cleanup listener for all non-persistent tasks +var beforeExitRan = false; + process.on('beforeExit', function() { + if (beforeExitRan) return; + + beforeExitRan = true; gulp.start('cleanup.builder'); });