Work around a cordova bug

Fixes #3914.  Fixes self-test 'add cordova plugins'.
This commit is contained in:
David Glasser
2015-03-10 21:48:20 -07:00
parent 52d500e123
commit 031237573a
2 changed files with 8 additions and 0 deletions

View File

@@ -482,6 +482,12 @@ var installPlugin = function (cordovaPath, name, version, conf) {
{ cwd: cordovaPath, env: buildCordovaEnv() });
if (! execRes.success)
throw new Error("Failed to install plugin " + name + ": " + execRes.stderr);
// Starting with cordova-lib 4.0.0, `plugin add` fails to exit non-zero on
// this particular error, and it prints the error on stdout. See
// https://github.com/meteor/meteor/issues/3914
if (execRes.stdout.match(/Variable\(s\) missing/)) {
throw new Error("Failed to install plugin " + name + ": " + execRes.stdout);
}
if (utils.isUrlWithSha(version)) {
var lock = getTarballPluginsLock(cordovaPath);

View File

@@ -171,10 +171,12 @@ selftest.define("add cordova plugins", ["slow", "cordova"], function () {
run = s.run("add", "cordova:foo@1.0.0");
run.waitSecs(5);
run.match("added cordova plugin foo");
run.expectExit(0);
run = s.run("remove", "cordova:foo");
run.waitSecs(5);
run.match("removed cordova plugin foo");
run.expectExit(0);
checkUserPlugins(s, ["org.apache.cordova.camera"]);