Github user jsoref commented on a diff in the pull request:

    https://github.com/apache/cordova-cli/pull/161#discussion_r11502427
  
    --- Diff: src/superspawn.js ---
    @@ -67,11 +69,11 @@ exports.spawn = function(cmd, args, opts) {
         var spawnOpts = {};
         var d = Q.defer();
     
    -    if (process.platform == 'win32') {
    +    if (iswin32) {
             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 (!fs.existsSync(cmd)) {
    +        if (wrapcmd && path.extname(cmd) != '.exe' || !fs.existsSync(cmd)) 
{
    --- End diff --
    
    @sgrebnov you misread it, we need this for everything that is `!=` `.exe`.
    
    For `.exe`, **Windows** passes arguments directly to the executable, and 
the executable (or its runtime, e.g. `libc`/`msvcrt`) is responsible for 
parsing the string into its arguments array (if it believes in arguments arrays 
at all).
    
    For `.bat`, or anything else, **Windows** won't actually launch them if you 
use the thing that `child_process.spawn` see: 
https://github.com/joyent/node/issues/2318 so, `child_process.spawn` has to run 
`cmd.exe` with the arguments. But `cmd.exe` has its own argument parsing which 
treats `"`s differently. In order to get `cmd.exe` to handle `"`s reasonably, 
you need to pass it `/s` which is what this block does (see the line below).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to