This commit is contained in:
Artur Gurgul 2025-08-28 17:48:34 +02:00
parent 764967c8e0
commit 93f402b012
9 changed files with 299 additions and 4 deletions

View file

@ -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