save
This commit is contained in:
parent
764967c8e0
commit
93f402b012
9 changed files with 299 additions and 4 deletions
|
|
@ -47,4 +47,26 @@ module System
|
|||
def self.arch_to_symbol(arch)
|
||||
normalize_architecture_string(arch)
|
||||
end
|
||||
|
||||
|
||||
def self.exec_ssh(port)
|
||||
require "socket"
|
||||
|
||||
host = "localhost"
|
||||
cmd = "ssh -p #{port} user@#{host}"
|
||||
|
||||
# Wait until the port is open
|
||||
puts "Waiting for #{host}:#{port}..."
|
||||
until begin
|
||||
TCPSocket.new(host, port).close
|
||||
true
|
||||
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH, SocketError
|
||||
false
|
||||
end
|
||||
sleep 0.1
|
||||
end
|
||||
|
||||
puts "Port open! Executing: #{cmd}"
|
||||
exec cmd
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue