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
|
// Run it
|
||||||
TaskRun.prototype.run = function(done) {
|
TaskRun.prototype.run = function(done) {
|
||||||
var self = this, args;
|
var self = this;
|
||||||
|
|
||||||
// Dont run if already running
|
// Dont run if already running
|
||||||
if (self.startedAt !== false) { return; }
|
if (self.startedAt !== false) { return; }
|
||||||
@ -47,10 +47,6 @@ module.exports = function(grunt) {
|
|||||||
grunt.task.run(self.tasks);
|
grunt.task.run(self.tasks);
|
||||||
done();
|
done();
|
||||||
} else {
|
} 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({
|
self.spawned = grunt.util.spawn({
|
||||||
// Spawn with the grunt bin
|
// Spawn with the grunt bin
|
||||||
grunt: true,
|
grunt: true,
|
||||||
@ -59,7 +55,8 @@ module.exports = function(grunt) {
|
|||||||
cwd: self.options.cwd,
|
cwd: self.options.cwd,
|
||||||
stdio: 'inherit',
|
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) {
|
}, function(err, res, code) {
|
||||||
// Spawn is done
|
// Spawn is done
|
||||||
self.spawned = null;
|
self.spawned = null;
|
||||||
|
@ -148,6 +148,9 @@ module.exports = function(grunt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-grab task options in case they changed between runs
|
||||||
|
self.options = grunt.config([self.name, 'options']) || {};
|
||||||
|
|
||||||
// If we should interrupt
|
// If we should interrupt
|
||||||
if (self.running === true) {
|
if (self.running === true) {
|
||||||
var shouldInterrupt = true;
|
var shouldInterrupt = true;
|
||||||
@ -178,6 +181,10 @@ module.exports = function(grunt) {
|
|||||||
grunt.util.async.forEachSeries(self.queue, function(name, next) {
|
grunt.util.async.forEachSeries(self.queue, function(name, next) {
|
||||||
var tr = self.targets[name];
|
var tr = self.targets[name];
|
||||||
if (!tr) { return next(); }
|
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) {
|
if (tr.options.spawn === false || tr.options.nospawn === true) {
|
||||||
shouldComplete = false;
|
shouldComplete = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user