mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-27 12:26:22 +00:00
Merge branch 'deadlock' into panel.sutty.nl
This commit is contained in:
commit
826461eef1
1 changed files with 8 additions and 6 deletions
|
@ -49,20 +49,22 @@ class Deploy < ApplicationRecord
|
|||
#
|
||||
# @param [String]
|
||||
# @return [Boolean]
|
||||
def run(cmd)
|
||||
def run(cmd, output: false)
|
||||
r = nil
|
||||
lines = []
|
||||
|
||||
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
|
||||
Thread.new do
|
||||
o.each do |line|
|
||||
lines << line
|
||||
|
||||
puts line if output
|
||||
end
|
||||
end
|
||||
r = t.value
|
||||
end
|
||||
end
|
||||
time_stop
|
||||
|
|
Loading…
Reference in a new issue