Skip to content

Commit 42fda29

Browse files
committed
fix(run): when target is passed to cordova through spawn remove quotes
1 parent 79e2d6e commit 42fda29

2 files changed

Lines changed: 3 additions & 21 deletions

File tree

lib/utils/cordova.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ var Serve = IonicAppLib.serve;
1010
var Project = IonicAppLib.project;
1111
var log = IonicAppLib.logging.logger;
1212
var ConfigXml = IonicAppLib.configXml;
13-
var crossSpawn = require('cross-spawn');
13+
var crossSpawn = require('cross-spawn');
1414
var npmScripts = require('../utils/npmScripts');
1515
var serveUtils = require('../utils/serve');
1616

@@ -233,14 +233,6 @@ function filterArgumentsForCordova(cmdName, argv, rawCliArguments) {
233233

234234
// Only return true if the arg is not found in the ignore Cmds list
235235
return ignoreCmds.indexOf(arg) === -1;
236-
}).map(function(arg) {
237-
238-
// If the arg is the target command and it does not contain double quotes add them
239-
// because process.argv removes them
240-
if (arg.indexOf('--target=') === 0 && arg.indexOf('"') === -1) {
241-
return arg.replace('--target=', '--target="') + '"';
242-
}
243-
return arg;
244236
});
245237
}
246238

spec/utils/cordova.spec.js

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var optimist = require('optimist');
88
var IonicAppLib = require('ionic-app-lib');
99
var Project = require('ionic-app-lib').project;
1010
var Serve = require('ionic-app-lib').serve;
11-
var crossSpawn = require('cross-spawn');
11+
var crossSpawn = require('cross-spawn');
1212
var ConfigXml = require('ionic-app-lib').configXml;
1313
var log = IonicAppLib.logging.logger;
1414

@@ -409,16 +409,6 @@ describe('filterArgumentsForCordova', function() {
409409
var cmdName = argv._[0];
410410

411411
var resultArgs = cordovaUtils.filterArgumentsForCordova(cmdName, argv, rawCliArguments);
412-
expect(resultArgs).toEqual(['build', '--target="ios"']);
413-
});
414-
it('should ensure that the --target= parameter contains double quotes when quotes are not removed', function() {
415-
var processArguments = ['node', 'ionic', 'build',
416-
'--target="ios"'];
417-
var rawCliArguments = processArguments.slice(2);
418-
var argv = optimist(rawCliArguments).argv;
419-
var cmdName = argv._[0];
420-
421-
var resultArgs = cordovaUtils.filterArgumentsForCordova(cmdName, argv, rawCliArguments);
422-
expect(resultArgs).toEqual(['build', '--target="ios"']);
412+
expect(resultArgs).toEqual(['build', '--target=ios']);
423413
});
424414
});

0 commit comments

Comments
 (0)