Re-grab task/target options on each run. Ref GH-158.
This commit is contained in:
parent
2c4d3e720f
commit
130d6dc1dd
@ -32,7 +32,7 @@ module.exports = function(grunt) {
|
||||
|
||||
// Run it
|
||||
TaskRun.prototype.run = function(done) {
|
||||
var self = this, args;
|
||||
var self = this;
|
||||
|
||||
// Dont run if already running
|
||||
if (self.startedAt !== false) { return; }
|
||||
@ -47,10 +47,6 @@ module.exports = function(grunt) {
|
||||
grunt.task.run(self.tasks);
|
||||
done();
|
||||
} else {
|
||||
// Run grunt this process uses, append the task to be run and any cli options
|
||||
args = self.tasks
|
||||
.concat(self.options.cliArgs || [])
|
||||
.concat(grunt.config(['watch', 'options', 'cliArgs']) || []);
|
||||
self.spawned = grunt.util.spawn({
|
||||
// Spawn with the grunt bin
|
||||
grunt: true,
|
||||
@ -59,7 +55,8 @@ module.exports = function(grunt) {
|
||||
cwd: self.options.cwd,
|
||||
stdio: 'inherit',
|
||||
},
|
||||
args: args
|
||||
// Run grunt this process uses, append the task to be run and any cli options
|
||||
args: self.tasks.concat(self.options.cliArgs || []),
|
||||
}, function(err, res, code) {
|
||||
// Spawn is done
|
||||
self.spawned = null;
|
||||
|
@ -148,6 +148,9 @@ module.exports = function(grunt) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Re-grab task options in case they changed between runs
|
||||
self.options = grunt.config([self.name, 'options']) || {};
|
||||
|
||||
// If we should interrupt
|
||||
if (self.running === true) {
|
||||
var shouldInterrupt = true;
|
||||
@ -178,6 +181,10 @@ module.exports = function(grunt) {
|
||||
grunt.util.async.forEachSeries(self.queue, function(name, next) {
|
||||
var tr = self.targets[name];
|
||||
if (!tr) { return next(); }
|
||||
|
||||
// Re-grab options in case they changed between runs
|
||||
tr.options = grunt.util._.defaults(grunt.config([self.name, name, 'options']) || {}, self.options);
|
||||
|
||||
if (tr.options.spawn === false || tr.options.nospawn === true) {
|
||||
shouldComplete = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user