diff --git a/lib/irb/command/backtrace.rb b/lib/irb/command/backtrace.rb index 610f9ee22..687bb075a 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 42ee002ce..a8f81fe66 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 655c77d8a..529dcbca5 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 49e4384eb..0daa029b1 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 aeafe19b5..f9aca0a67 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 4b45a51e7..2a57a4a3d 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 c1d62357f..3311a0e6e 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 897ee2c43..d08ce00a3 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 92d28e33e..3fc6b68d2 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 514981302..29e5e35ac 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