5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-07-05 21:05:45 +00:00

leer la salida por separado para no bloquear el programa

This commit is contained in:
f 2022-03-14 13:40:17 -03:00
parent 2b4cf2bc75
commit 878311abf6

View file

@ -62,14 +62,15 @@ class Deploy < ApplicationRecord
time_start
Dir.chdir(site.path) do
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?
o.each do |line|
lines << line
puts line if output
Thread.new do
o.each do |line|
lines << line
puts line if output
end
end
r = t.value
end
end
time_stop