你如何从rake运行NUnit?你在用"sh"吗?
这是你使用"sh"执行shell命令并拦截结果的方法.
我只是使用空块来忽略任何结果(失败或成功)
            sh "your shell command" do |ok,res|
                #empty block to ignore any failed or success status
                #in your case set failed flag based on ok parameter
               nunitSuccessFlag=false #hardcoded for sample; must set true or false based on ok parameter
            end
关闭服务器后将此引发异常置于有效状态,以便ccnet知道构建失败
    raise "NUnit failed" if nunitSuccessFlag == false
替代方法:使用上面用户knut所述的try catch块,如以下链接所示: Rake Task:错误处理(在ensure块中关闭服务器)
我用它来rake忽略从命令返回的状态:
sh "the command || true"
true总是没有错误地退出,使sh总是看到成功。
| 归档时间: | 
 | 
| 查看次数: | 3263 次 | 
| 最近记录: |