diff --git a/tools/commands-cordova.js b/tools/commands-cordova.js index 3baf71e4f9..9ca64531ed 100644 --- a/tools/commands-cordova.js +++ b/tools/commands-cordova.js @@ -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); diff --git a/tools/tests/cordova-plugins.js b/tools/tests/cordova-plugins.js index a013101584..473afcd908 100644 --- a/tools/tests/cordova-plugins.js +++ b/tools/tests/cordova-plugins.js @@ -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"]);