fix: remove Thread wrapper to prevent Bundler from killing background restart thread

This commit is contained in:
rulingcom 2026-07-06 14:16:07 +08:00
parent 029cc02d11
commit 3990e89f57
1 changed files with 6 additions and 11 deletions

View File

@ -246,18 +246,13 @@ if bundle_update_flag
#file.chmod(0755)
#file.close
restart_cmd = "UNICORN_PID=\"`fuser tmp/pids/unicorn.sock tmp/sockets/unicorn.sock tmp/unicorn.sock` `cat tmp/pids/unicorn.pid `\" && kill -s TERM $UNICORN_PID ; while (kill -0 $UNICORN_PID > /dev/null 2>&1) ; do printf '.' && sleep 1 ; done ; unset UNICORN_FD; bundle exec unicorn_rails -c config/unicorn.rb -D -E #{mode}"
a = Thread.start do
bundler_with_clean_env do
puts env_pwd
puts mode
Open3.capture3("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} #{restart_cmd};#{watch_dog_cmd}\" ")
end
bundler_with_clean_env do
puts env_pwd
puts mode
pid = Process.spawn("cd #{env_pwd} && env -i HOME=\"$HOME\" bash -l -c \"#{all_command}\" ;screen -d -m -S auto_reopen_#{dir_name} bash -c \"#{use_cmd} #{restart_cmd};#{watch_dog_cmd}\" ")
Process.detach(pid)
end
now_priority = Thread.current.priority.to_i
system('sleep 2')
a.priority = now_priority + 2
a.run
#Thread.exit
else
dir_name = env_pwd.split('/')[-1]