Capistrano & Bash: ignore command exit status

前端 未结 7 586
礼貌的吻别
礼貌的吻别 2021-01-31 14:11

I\'m using Capistrano run a remote task. My task looks like this:

task :my_task do
  run \"my_command\"
end

My problem is that if my_comm

7条回答
  •  北恋
    北恋 (楼主)
    2021-01-31 14:57

    I just redirect STDERR and STDOUT to /dev/null, so your

    run "my_command"
    

    becomes

    run "my_command > /dev/null 2> /dev/null"
    

    this works for standard unix tools pretty well, where, say, cp or ln could fail, but you don't want to halt deployment on such a failure.

提交回复
热议问题