Nate Eagleson created CB-12521:
----------------------------------

             Summary: CORDOVA_CMDLINE fails on spaces in passed arguments
                 Key: CB-12521
                 URL: https://issues.apache.org/jira/browse/CB-12521
             Project: Apache Cordova
          Issue Type: Bug
          Components: CordovaLib
    Affects Versions: 6.3.1
         Environment: Mac OS X 10.11.16, bash 3.2.57(1)-release [default OS X 
version]
            Reporter: Nate Eagleson
            Priority: Minor


I have been working on a project that uses the {{CORDOVA_CMDLINE}} variable to 
pass arguments to hooks.

Today I tried to add a new option for one of our hooks, but in the hook only 
received part of the value I tried to pass.

After some poking, I found that this command:

{{cordova prepare --custom-option='Test Argument'}}

results in {{CORDOVA_CMDLINE}} being populated with something like this:

{{/Users/username/.nvm/versions/node/v6.9.5/bin/node 
/Users/username/project/node_modules/.bin/cordova prepare --custom-option=Test 
Argument}}

Since {{Test Argument}} is no longer quoted, nor is its embedded space  
escaped, we can't pass values with spaces in them to our hook.

The offending code seems to be here:

https://github.com/apache/cordova-lib/blob/rel/6.3.1/cordova-lib/src/hooks/HooksRunner.js#L222

It seems like it should be quoting or escaping the values in process.argv 
before joining them into {{CORDOVA_CMDLINE}}.

I'm not very familiar with Windows shell syntax, so I hesitate to propose a 
solution.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to