From 53a547d446b4549214da78c54cc049a814de2308 Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Sat, 3 Aug 2024 01:16:58 +0100 Subject: [PATCH] debrew/irb: fix errors under Ruby 3.3 --- Library/Homebrew/debrew/irb.rb | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/Library/Homebrew/debrew/irb.rb b/Library/Homebrew/debrew/irb.rb index ade8673e47dcb..5b204a576ce00 100644 --- a/Library/Homebrew/debrew/irb.rb +++ b/Library/Homebrew/debrew/irb.rb @@ -5,6 +5,9 @@ module IRB def self.start_within(binding) + old_stdout_sync = $stdout.sync + $stdout.sync = true + unless @setup_done setup(nil, argv: []) @setup_done = true @@ -12,21 +15,8 @@ def self.start_within(binding) workspace = WorkSpace.new(binding) irb = Irb.new(workspace) - - @CONF[:IRB_RC]&.call(irb.context) - @CONF[:MAIN_CONTEXT] = irb.context - - prev_trap = trap("SIGINT") do - irb.signal_handle - end - - begin - catch(:IRB_EXIT) do - irb.eval_input - end - ensure - trap("SIGINT", prev_trap) - irb_at_exit - end + irb.run(conf) + ensure + $stdout.sync = old_stdout_sync end end