Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby debugger fails on STDIN.gets user input

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?

like image 978
aristofun Avatar asked Jun 30 '15 19:06

aristofun


1 Answers

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

like image 134
ajsrn Avatar answered Sep 29 '22 06:09

ajsrn