ConradIrwin / pry-rescue

Start a pry session whenever something goes wrong.
MIT License
852 stars 49 forks source link

Ruby 3.2 incompatibility due to removal of File.exists? alias #125

Closed taw closed 1 year ago

taw commented 1 year ago
$ cat hello
#!/usr/bin/env ruby
puts "Hello, world!"
$ rescue hello
/Users/taw/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/pry-rescue-1.5.2/bin/rescue:55:in `<top (required)>': undefined method `exists?' for File:Class (NoMethodError)

  if File.exists? script
         ^^^^^^^^
Did you mean?  exist?
    from /Users/taw/.rbenv/versions/3.2.2/bin/rescue:25:in `load'
    from /Users/taw/.rbenv/versions/3.2.2/bin/rescue:25:in `<main>'

From changelog for Ruby 3.2.

The fix is to just use File.exist? instead of File.exists?

lucianoshl commented 1 year ago

+1