From f9f917bfa49ea841a2bb2e977ccc48181fdbb63f Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Tue, 19 May 2015 21:58:36 -0700 Subject: [PATCH] build(gulp): fix cleanup.builder task - wait for the cleanup to finish (it's async) before exiting on ctrl+c - wait for the cleanup to finish (it's async) onBeforeExit - remove tmp directory during onBeforeExit to cleanup past leaks Closes #1919 --- gulpfile.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 6577eee0f1..66fb7d7943 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -823,17 +823,22 @@ gulp.task('build.dart.material', ['build/packages.dart'], function() { }); -gulp.task('cleanup.builder', function() { - angularBuilder.cleanup(); +gulp.task('cleanup.builder', function(done) { + angularBuilder.cleanup().then(function() { + del('tmp', done); // TODO(iminar): remove after 2015-06-01 + // this is here just to cleanup old files that we leaked in the past + }); }); // register cleanup listener for ctrl+c/kill used to quit any persistent task (autotest or serve tasks) process.on('SIGINT', function() { - gulp.start('cleanup.builder'); - process.exit(); + runSequence('cleanup.builder', function() { + process.exit(); + }); }); + // register cleanup listener for all non-persistent tasks var beforeExitRan = false;