From 6c5ad6a0e0708f682dbc3afacde59ec940a3dd84 Mon Sep 17 00:00:00 2001 From: Stan Lo Date: Thu, 11 Apr 2024 01:33:40 +0800 Subject: [PATCH] [ruby/irb] Centralize rstrip calls (https://github.com/ruby/irb/pull/918) https://github.com/ruby/irb/commit/97898b6251 --- lib/irb/command/backtrace.rb | 2 +- lib/irb/command/break.rb | 2 +- lib/irb/command/catch.rb | 2 +- lib/irb/command/continue.rb | 2 +- lib/irb/command/debug.rb | 3 +++ lib/irb/command/delete.rb | 2 +- lib/irb/command/finish.rb | 2 +- lib/irb/command/info.rb | 2 +- lib/irb/command/next.rb | 2 +- lib/irb/command/step.rb | 2 +- 10 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/irb/command/backtrace.rb b/lib/irb/command/backtrace.rb index 610f9ee22c70f1..687bb075ace9fc 100644 --- a/lib/irb/command/backtrace.rb +++ b/lib/irb/command/backtrace.rb @@ -8,7 +8,7 @@ module IRB module Command class Backtrace < DebugCommand def execute(arg) - execute_debug_command(pre_cmds: "backtrace #{arg}".rstrip) + execute_debug_command(pre_cmds: "backtrace #{arg}") end end end diff --git a/lib/irb/command/break.rb b/lib/irb/command/break.rb index 42ee002ce8a2e5..a8f81fe665077b 100644 --- a/lib/irb/command/break.rb +++ b/lib/irb/command/break.rb @@ -8,7 +8,7 @@ module IRB module Command class Break < DebugCommand def execute(arg) - execute_debug_command(pre_cmds: "break #{arg}".rstrip) + execute_debug_command(pre_cmds: "break #{arg}") end end end diff --git a/lib/irb/command/catch.rb b/lib/irb/command/catch.rb index 655c77d8af7157..529dcbca5aed09 100644 --- a/lib/irb/command/catch.rb +++ b/lib/irb/command/catch.rb @@ -8,7 +8,7 @@ module IRB module Command class Catch < DebugCommand def execute(arg) - execute_debug_command(pre_cmds: "catch #{arg}".rstrip) + execute_debug_command(pre_cmds: "catch #{arg}") end end end diff --git a/lib/irb/command/continue.rb b/lib/irb/command/continue.rb index 49e4384eb3eb78..0daa029b154042 100644 --- a/lib/irb/command/continue.rb +++ b/lib/irb/command/continue.rb @@ -8,7 +8,7 @@ module IRB module Command class Continue < DebugCommand def execute(arg) - execute_debug_command(do_cmds: "continue #{arg}".rstrip) + execute_debug_command(do_cmds: "continue #{arg}") end end end diff --git a/lib/irb/command/debug.rb b/lib/irb/command/debug.rb index aeafe19b5fcc6f..f9aca0a672b4c6 100644 --- a/lib/irb/command/debug.rb +++ b/lib/irb/command/debug.rb @@ -18,6 +18,9 @@ def execute(_arg) end def execute_debug_command(pre_cmds: nil, do_cmds: nil) + pre_cmds = pre_cmds&.rstrip + do_cmds = do_cmds&.rstrip + if irb_context.with_debugger # If IRB is already running with a debug session, throw the command and IRB.debug_readline will pass it to the debugger. if cmd = pre_cmds || do_cmds diff --git a/lib/irb/command/delete.rb b/lib/irb/command/delete.rb index 4b45a51e73cca3..2a57a4a3de06d2 100644 --- a/lib/irb/command/delete.rb +++ b/lib/irb/command/delete.rb @@ -8,7 +8,7 @@ module IRB module Command class Delete < DebugCommand def execute(arg) - execute_debug_command(pre_cmds: "delete #{arg}".rstrip) + execute_debug_command(pre_cmds: "delete #{arg}") end end end diff --git a/lib/irb/command/finish.rb b/lib/irb/command/finish.rb index c1d62357f4706d..3311a0e6e9e405 100644 --- a/lib/irb/command/finish.rb +++ b/lib/irb/command/finish.rb @@ -8,7 +8,7 @@ module IRB module Command class Finish < DebugCommand def execute(arg) - execute_debug_command(do_cmds: "finish #{arg}".rstrip) + execute_debug_command(do_cmds: "finish #{arg}") end end end diff --git a/lib/irb/command/info.rb b/lib/irb/command/info.rb index 897ee2c4307956..d08ce00a320aab 100644 --- a/lib/irb/command/info.rb +++ b/lib/irb/command/info.rb @@ -8,7 +8,7 @@ module IRB module Command class Info < DebugCommand def execute(arg) - execute_debug_command(pre_cmds: "info #{arg}".rstrip) + execute_debug_command(pre_cmds: "info #{arg}") end end end diff --git a/lib/irb/command/next.rb b/lib/irb/command/next.rb index 92d28e33ef19a1..3fc6b68d21f4b3 100644 --- a/lib/irb/command/next.rb +++ b/lib/irb/command/next.rb @@ -8,7 +8,7 @@ module IRB module Command class Next < DebugCommand def execute(arg) - execute_debug_command(do_cmds: "next #{arg}".rstrip) + execute_debug_command(do_cmds: "next #{arg}") end end end diff --git a/lib/irb/command/step.rb b/lib/irb/command/step.rb index 51498130293fa1..29e5e35ac0135b 100644 --- a/lib/irb/command/step.rb +++ b/lib/irb/command/step.rb @@ -8,7 +8,7 @@ module IRB module Command class Step < DebugCommand def execute(arg) - execute_debug_command(do_cmds: "step #{arg}".rstrip) + execute_debug_command(do_cmds: "step #{arg}") end end end