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

Merge branch 'issue-13619' into 'rails'
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

fix: deprecar Dir#chdir #13619

Closes #13619, #13715, #13716, and #13717

See merge request sutty/sutty!193
This commit is contained in:
Elihu 2023-09-27 15:18:50 +00:00
commit 9bd591ec27
2 changed files with 18 additions and 14 deletions

View file

@ -65,22 +65,20 @@ class Deploy < ApplicationRecord
lines = []
time_start
Dir.chdir(site.path) do
Open3.popen2e(env, cmd, unsetenv_others: true) do |_, o, t|
# TODO: Enviar a un websocket para ver el proceso en vivo?
Thread.new do
o.each do |line|
lines << line
Open3.popen2e(env, cmd, unsetenv_others: true, chdir: site.path) do |_, o, t|
# TODO: Enviar a un websocket para ver el proceso en vivo?
Thread.new do
o.each do |line|
lines << line
puts line if output
end
rescue IOError => e
lines << e.message
puts e.message if output
puts line if output
end
r = t.value
rescue IOError => e
lines << e.message
puts e.message if output
end
r = t.value
end
time_stop

View file

@ -447,6 +447,10 @@ class Site < ApplicationRecord
find_by(name: "#{Site.domain}.")
end
def self.one_at_a_time
@@one_at_a_time ||= Thread::Mutex.new
end
def reset
@read = false
@layouts = nil
@ -553,7 +557,9 @@ class Site < ApplicationRecord
end
def run_in_path(&block)
Dir.chdir path, &block
Site.one_at_a_time.synchronize do
Dir.chdir path, &block
end
end
# Instala las gemas cuando es necesario: