Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip --gruntfile and --base args when re-spawning Grunt… #479

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion tasks/lib/taskrun.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

'use strict';

var path = require('path');

module.exports = function(grunt) {

// Create a TaskRun on a target
Expand Down Expand Up @@ -65,6 +67,15 @@ module.exports = function(grunt) {
grunt.task.run(self.tasks);
done();
} else {
var cliArgs = self.options.cliArgs.slice();
var pos = cliArgs.indexOf('--base');
if (pos >= 0) {
cliArgs.splice(pos, 2);
}
pos = cliArgs.indexOf('--gruntfile');
if (pos >= 0) {
cliArgs[pos + 1] = path.basename(cliArgs[pos + 1]);
}
self.spawned = grunt.util.spawn({
// Spawn with the grunt bin
grunt: true,
Expand All @@ -74,7 +85,7 @@ module.exports = function(grunt) {
stdio: 'inherit'
},
// Run grunt this process uses, append the task to be run and any cli options
args: self.tasks.concat(self.options.cliArgs || [])
args: self.tasks.concat(cliArgs || []),
}, function(err, res, code) {
self.spawnTaskFailure = (code !== 0);
if (self.options.interrupt !== true || (code !== 130 && code !== 1)) {
Expand Down