cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [1/8] cordova-lib git commit: CB-9073 Allow to add platform if project path contains `&` symbol
Date Thu, 04 Jun 2015 17:36:17 GMT
Repository: cordova-lib
Updated Branches:
  refs/heads/5.1.x d57d70bbc -> 3f63afb6f


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/5e086ebb
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/5e086ebb
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/5e086ebb

Branch: refs/heads/5.1.x
Commit: 5e086ebb9bcf352dfc7601847beef657f14c870a
Parents: d57d70b
Author: Vladimir Kotikov <v-vlkoti@microsoft.com>
Authored: Tue May 26 14:39:34 2015 +0300
Committer: Steve Gill <stevengill97@gmail.com>
Committed: Thu Jun 4 10:07:21 2015 -0700

----------------------------------------------------------------------
 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/5e086ebb/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


Mime
View raw message