microsoft / vsts-cordova-tasks

Streamline CI setup for your Apache Cordova, PhoneGap, Ionic, or Cordova CLI compatible app using a set of useful pre-defined build steps for VS Team Services or TFS
http://go.microsoft.com/fwlink/?LinkID=691188
Other
25 stars 27 forks source link

Not specifying advanced arguments results in "Cannot read property 'match' of undefined" error #20

Closed palmsey closed 8 years ago

palmsey commented 8 years ago

Adding a space to the Advanced > Arguments field gets around the error.

I think this is due to:

var rawArgs = taskLibrary.getInput('cordovaArgs', /* required */ false); var args = rawArgs.match(/([^" ]*("[^"]*")[^" ]*)|[^" ]+/g);

rawArgs should be checked before calling match.

Chuxel commented 8 years ago

@palmsey Which task is this happening on? All of them or one in particular? (Cordova Build, Cordova Command, Ionic Command, PhoneGap Command)

@ryuyu Can you investigate? This may be due to subtle differences in how VSTS can pass back args since I know we didn't see this during testing

palmsey commented 8 years ago

I've only tried Cordova Build.

ryuyu commented 8 years ago

I have just submitted a PR to fix this (https://github.com/Microsoft/vsts-cordova-tasks/pull/21)

ryuyu commented 8 years ago

It would also appear that this particular issue only surfaces in Cordova Build task as far as I can tell. The other tasks don't do a regex match explicitly, and instead pass the equivalent rawArgs string directly to the command to be executed, which in turn does the regex match and check. We couldn't use this mechanism in the Cordova Build task because we do some additional processing of the args that the task library parsing doesn't do.

Chuxel commented 8 years ago

Thanks for reporting @palmsey. We'll work on getting a 1.1.2 update out quickly since this could be common even though we didn't see it in testing.

Chuxel commented 8 years ago

Cordova Build 1.1.2 was just released. You should see the update land in your account in the next few hours. Let us know if this does not resolve the issue for you.