Revert "Run again if interrupt off and triggered during previous run. Closes GH-33."

This reverts commit d01491be1b.
pull/89/head
Kyle Robinson Young 12 years ago
parent f1af227d22
commit f8a7b3cebe

@ -42,8 +42,6 @@ module.exports = function(grunt) {
this.nameArgs = [];
// A list of changed files to feed to task runs for livereload
this.changedFiles = Object.create(null);
// Flag to set if interrupt is false and a change happened during a task run
this.needsAnotherRun = false;
}
util.inherits(Runner, EE);
@ -150,7 +148,6 @@ module.exports = function(grunt) {
self.interrupt();
} else {
// Dont interrupt the tasks running
self.needsAnotherRun = true;
return;
}
}
@ -218,26 +215,15 @@ module.exports = function(grunt) {
var self = this;
if (self.running === false) { return; }
self.running = false;
var time = 0;
self._queue.forEach(function(name, i) {
var target = self._targets[name];
if (!target) { return; }
if (target.startedAt !== false) {
time += target.complete();
if (self.needsAnotherRun !== true) {
self._queue[i] = null;
}
self._queue[i] = null;
}
});
// If it needs another run
if (self.needsAnotherRun === true) {
self.needsAnotherRun = false;
self.run();
return;
}
var elapsed = (time > 0) ? Number(time / 1000) : 0;
self.changedFiles = Object.create(null);
self.emit('end', elapsed);

@ -2,7 +2,7 @@
* grunt-contrib-watch
* http://gruntjs.com/
*
* Copyright (c) 2013 "Cowboy" Ben Alman, contributors
* Copyright (c) 2012 "Cowboy" Ben Alman, contributors
* Licensed under the MIT license.
*/
@ -10,7 +10,7 @@ module.exports = function(grunt) {
'use strict';
grunt.registerMultiTask('echo', 'A task that echos a message.', function() {
var msg = this.data.message || 'I do absolutely nothing.';
var wait = this.data.wait || grunt.option('wait') || 0;
var wait = this.data.wait || 0;
var fail = this.data.fail || false;
var done = this.async();

@ -125,23 +125,5 @@ exports.watchConfig = {
test.equal(grunt.util._(result).count('Waiting...'), 2, 'Should have displayed "Wating..." twice');
test.done();
});
},
runAgainNotInterrupted: function(test) {
test.expect(1);
var cwd = path.resolve(fixtures, 'multiTargets');
var assertWatch = helper.assertTask(['watch:one', '--wait=4000'], {cwd:cwd});
assertWatch([function() {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var test = true;');
setTimeout(function() {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var test = true;');
}, 2000);
setTimeout(function() {
grunt.file.write(path.join(cwd, 'lib', 'one.js'), 'var test = true;');
}, 3000);
}], function(result) {
helper.verboseLog(result);
test.equal(grunt.util._(result).count('one has changed'), 2, 'Should have ran the one task twice.');
test.done();
});
},
}
};

Loading…
Cancel
Save