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
This commit is contained in:
Igor Minar 2015-05-19 21:58:36 -07:00
parent e89bf01c2b
commit f9f917bfa4
1 changed files with 9 additions and 4 deletions

View File

@ -823,17 +823,22 @@ gulp.task('build.dart.material', ['build/packages.dart'], function() {
}); });
gulp.task('cleanup.builder', function() { gulp.task('cleanup.builder', function(done) {
angularBuilder.cleanup(); 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) // register cleanup listener for ctrl+c/kill used to quit any persistent task (autotest or serve tasks)
process.on('SIGINT', function() { process.on('SIGINT', function() {
gulp.start('cleanup.builder'); runSequence('cleanup.builder', function() {
process.exit(); process.exit();
});
}); });
// register cleanup listener for all non-persistent tasks // register cleanup listener for all non-persistent tasks
var beforeExitRan = false; var beforeExitRan = false;