When running guard in a Rails 4 project with guard-rspec, I sporadically see the following error when opening/closing files in vim. I've tried upgrading/downgrading guard, guard-rspec, pry, and other libraries without luck.
Below is the stacktrace I see every few test runs:
Error: can't modify string; temporarily locked
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:624:in `readline'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:624:in `block in readline'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:564:in `handle_read_errors'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:609:in `readline'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:384:in `retrieve_line'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:301:in `block in r'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:298:in `loop'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:298:in `r'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:276:in `re'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:254:in `rep'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:234:in `block (3 levels) in repl'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:232:in `loop'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:232:in `block (2 levels) in repl'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:231:in `catch'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:231:in `block in repl'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:230:in `catch'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_instance.rb:230:in `repl'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/pry-0.9.12.2/lib/pry/pry_class.rb:170:in `start'
/home/charles/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/guard-2.1.1/lib/guard/interactor.rb:133:in `block in start'
[1] Specs guard(main)>
Adding the rb-readline gem to my Gemfile seems to fix the issue.
gem "rb-readline", "~> 0.5.0"
My guess is the rbenv compiled version of Ruby 2.0.0-p247 has readline issues, which explains why the error occurs in pry_instance.rb:624:in 'readline'
. The rb-readline project is a pure ruby implementation of the readline library and seems to alleviate the issue.
There may be a better solution involving recompiling ruby, but I haven't found it.
It seems to be an error in Ruby 2.0.0 and 1.9.3 indeed. See https://bugs.ruby-lang.org/issues/8669
Its backported to Ruby 2.0.0 in revision 42216.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With