问题
I believe you can easily reproduce the issue. Just take a fresh RubyMine (7.1) — either Mac or Windows version, Ruby 2.2, create simple script:
puts "Hi, i'm gonna break your debugger :)"
user_input = gets
puts "Here should be breakpoint"
Put the breakpoint on the 3-rd line and run Debug session (RubyMine uses ruby-debug-ide
gem).
When you type something in RubyMine console window for the script to read in gets
— program doesn't eat your input saying:
Could not execute statement: current stack frame is unavailable. Pause the process to use console interpreter
What's going on here and how can you debug such Ruby scripts?
回答1:
This appears to be a RubyMine quirk. If you disable the console prompt by clicking on the 'Show Console Prompt' icon in the debug pane this should start working as you expect
See attached Screenshot if you are struggling to find the 'Show Console Prompt'enter image description here
来源:https://stackoverflow.com/questions/31147082/ruby-debugger-fails-on-stdin-gets-user-input