【问题标题】:How to exit a "cordova build" command from a hook?如何从钩子中退出“cordova build”命令?
【发布时间】:2017-07-18 09:59:22
【问题描述】:

我在 after_prepare 上使用带有钩子的 Cordova。 如果命令不正确,我想退出。

例如,这个命令是正确的:

cordova run android --ENV=PRD

这个不正确,我想中断 Cordova 的生命周期:

cordova run android --ENV=AEZAZEZ

我的钩子看起来像:

module.exports = function(ctx) {

var env     = ctx.opts.options.ENV;

if ( !CONFIG[env] ) {
    // there is a problem in the CLI, I want to exit

} else {

如何修改钩子以退出 Cordova 运行命令?

【问题讨论】:

    标签: cordova ionic-framework phonegap


    【解决方案1】:

    抛出未处理的异常:

    if ( !CONFIG[env] ) {
        throw "there is a problem in the CLI, I want to exit";
    } 
    

    【讨论】:

      猜你喜欢
      • 2014-08-16
      • 1970-01-01
      • 2014-03-19
      • 1970-01-01
      • 2015-08-24
      • 1970-01-01
      • 2015-03-02
      • 1970-01-01
      • 2019-12-09
      相关资源
      最近更新 更多