Capistrano在失败时运行本地命令退出

编程入门 行业动态 更新时间:2024-10-10 07:31:24
本文介绍了Capistrano在失败时运行本地命令退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想运行本地命令并在任何命令失败时退出。 Capistrano最好的方法是什么? run_locally将继续失败。

I would like to run local commands and exit on failure of any command. whats the best way to do this with capistrano? run_locally will continue going on failure.

我是否每次都要检查最后一个命令是否存在(或创建自定义的本地运行函数)?

Do i have to check the last commands exist status everytime (or create a custom run locally function)?

推荐答案

我必须创建自己的函数,如下所示:

I had to create my own function like this:

task :build_backend do run_local("echo hello") run_local("abcdef") run_local("echo 'not run'") end def run_local(cmd) system cmd if($?.exitstatus != 0) then puts 'exit code: ' + $?.exitstatus.to_s exit end end

使用此

更多推荐

Capistrano在失败时运行本地命令退出

本文发布于:2023-11-24 11:50:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1625091.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:时运   命令   Capistrano

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!