File run-backups-with-the-correct-ruby.patch of Package discourse
diff --git a/lib/backup_restore.rb b/lib/backup_restore.rb
index f30d82e32d2..8e1385010fe 100644
--- a/lib/backup_restore.rb
+++ b/lib/backup_restore.rb
@@ -191,7 +191,7 @@ module BackupRestore
def self.spawn_process!(type, user_id, opts)
script = File.join(Rails.root, "script", "spawn_backup_restore.rb")
- command = ["bundle", "exec", "ruby", script, type, user_id, opts.to_json].map(&:to_s)
+ command = [File.join(Rails.root, "bin", "bundle"), "exec", Gem.ruby, script, type, user_id, opts.to_json].map(&:to_s)
pid = spawn({ "RAILS_DB" => RailsMultisite::ConnectionManagement.current_db }, *command)
Process.detach(pid)