You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/05/28 10:23:16 UTC

cordova-lib git commit: CB-9073 Allow to add platform if project path contains `&` symbol

Repository: cordova-lib
Updated Branches:
  refs/heads/master 3ffe9b50c -> 82f40f59f


CB-9073 Allow to add platform if project path contains `&` symbol


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/82f40f59
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/82f40f59
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/82f40f59

Branch: refs/heads/master
Commit: 82f40f59f7e737401b1d92c98168940f9c659c09
Parents: 3ffe9b5
Author: Vladimir Kotikov <v-...@microsoft.com>
Authored: Tue May 26 14:39:34 2015 +0300
Committer: Vladimir Kotikov <v-...@microsoft.com>
Committed: Thu May 28 11:23:03 2015 +0300

----------------------------------------------------------------------
 cordova-lib/src/cordova/superspawn.js | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/82f40f59/cordova-lib/src/cordova/superspawn.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/cordova/superspawn.js b/cordova-lib/src/cordova/superspawn.js
index 92c16c4..e6e0a3b 100644
--- a/cordova-lib/src/cordova/superspawn.js
+++ b/cordova-lib/src/cordova/superspawn.js
@@ -48,9 +48,7 @@ function resolveWindowsExe(cmd) {
 }
 
 function maybeQuote(a) {
-    if (a.indexOf(' ') != -1) {
-        a = '"' + a + '"';
-    }
+    if (/^[^"].*[ &].*[^"]/.test(a)) return '"' + a + '"';
     return a;
 }
 
@@ -73,14 +71,15 @@ exports.spawn = function(cmd, args, opts) {
         cmd = resolveWindowsExe(cmd);
         // If we couldn't find the file, likely we'll end up failing,
         // but for things like "del", cmd will do the trick.
-        if (path.extname(cmd) != '.exe' && cmd.indexOf(' ') != -1) {
+        if (path.extname(cmd) != '.exe') {
+            var cmdArgs = '"' + [cmd].concat(args).map(maybeQuote).join(' ') + '"';
             // We need to use /s to ensure that spaces are parsed properly with cmd spawned content
-            args = [['/s', '/c', '"' + [cmd].concat(args).map(function(a){if (/^[^"].* .*[^"]/.test(a)) return '"' + a + '"'; return a;}).join(' ')+'"'].join(' ')];
+            args = [['/s', '/c', cmdArgs].join(' ')];
             cmd = 'cmd';
             spawnOpts.windowsVerbatimArguments = true;
         } else if (!fs.existsSync(cmd)) {
             // We need to use /s to ensure that spaces are parsed properly with cmd spawned content
-            args = ['/s', '/c', cmd].concat(args);
+            args = ['/s', '/c', cmd].concat(args).map(maybeQuote);
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org