5

When running bundle exec guard getting these warnings.

<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/workstation/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:40: warning: in `eval'
<main>:1: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/home/workstation/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:41: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/workstation/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:88: warning: in `eval'
<main>:1: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/home/workstation/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:80: warning: in `eval'

Its clearly coming from pry gem & too frustrating to see these on all test runs. How can I hide this from showing?

2
  • Try updating the pry gem. github.com/pry/pry/pull/1904 Commented Dec 28, 2019 at 10:30
  • @max updating wont work. Is there any way to hide the warnings in guard? Commented Dec 28, 2019 at 17:36

1 Answer 1

4

This is a known upstream bug in Pry specific to Ruby 2.7. Given Pry hasn't been updated in a while, a suggested fix (which worked for me) is to pull Pry from GitHub:

# Gemfile
source 'https://rubygems.org'

gem 'pry', git: 'https://github.com/pry/pry.git', ref: '272b3290b5250d28ee82a5ff65aa3b29b825e37b'
Sign up to request clarification or add additional context in comments.

1 Comment

This worked for me but also required bundle exec guard start instead of just guard start ... in case you still are seeing warning messages.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.