5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-27 14:16:21 +00:00

Merge branch 'deadlock' into panel.sutty.nl

This commit is contained in:
f 2022-03-14 13:41:15 -03:00
commit 826461eef1

View file

@ -49,20 +49,22 @@ class Deploy < ApplicationRecord
# #
# @param [String] # @param [String]
# @return [Boolean] # @return [Boolean]
def run(cmd) def run(cmd, output: false)
r = nil r = nil
lines = [] lines = []
time_start time_start
Dir.chdir(site.path) do Dir.chdir(site.path) do
Open3.popen2e(env, cmd, unsetenv_others: true) do |_, o, t| Open3.popen2e(env, cmd, unsetenv_others: true) do |_, o, t|
r = t.value
# XXX: Tenemos que leer línea por línea porque en salidas largas
# se cuelga la IO
# TODO: Enviar a un websocket para ver el proceso en vivo? # TODO: Enviar a un websocket para ver el proceso en vivo?
o.each do |line| Thread.new do
lines << line o.each do |line|
lines << line
puts line if output
end
end end
r = t.value
end end
end end
time_stop time_stop