From 3990e89f57e2c85dcf4499c8e43c136a22e6e0be Mon Sep 17 00:00:00 2001 From: rulingcom Date: Mon, 6 Jul 2026 14:16:07 +0800 Subject: [PATCH] fix: remove Thread wrapper to prevent Bundler from killing background restart thread --- announcement.gemspec | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/announcement.gemspec b/announcement.gemspec index 7702f94..65f71f3 100644 --- a/announcement.gemspec +++ b/announcement.gemspec @@ -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]