cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nate Eagleson (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-12521) CORDOVA_CMDLINE fails on spaces in passed arguments
Date Wed, 01 Mar 2017 16:39:45 GMT
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: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


Mime
View raw message