简体   繁体   English

退出的run_locallly ssh任务

[英]run_locallly ssh task that exits

I have this task in may deploy.rb file: 我在may deploy.rb文件中有此任务:

desc 'open ssh session in background'
  task :ssh_in_background do

    run_locally do 
      execute "ssh -o 'ExitOnForwardFailure yes' -NMS ~/.ssh-tunnel -f #{fetch(:rails_env)}-#{fetch(:application)}"
      execute "exit" 
    end
  end

When I run this task, all it does is hang. 当我运行此任务时,它所做的只是挂起。 It never quits despite the -f parameter. 尽管-f参数,但它永远不会退出。

How do I make this task exit so that capistrano will continue on? 如何退出此任务,以便capistrano继续执行?

I switched from capistrano's execute to ruby's system command. 我从capistrano的execute切换到ruby的system命令。

desc 'open ssh session in background'
  task :ssh_in_background do

    run_locally do 
      system "ssh -o 'ExitOnForwardFailure yes' -NMS ~/.ssh-tunnel -f #{fetch(:rails_env)}-#{fetch(:application)}"
    end
  end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM