mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Don't explode if the file we're in doesn't exist.
This happens particularly in testing where you want to delete files after each test, but the REPL state isn't reset correctly.
This commit is contained in:
parent
9c8eb6139b
commit
76d1c4ff70
1 changed files with 4 additions and 0 deletions
|
@ -147,6 +147,10 @@ class Pry
|
|||
set_file_and_dir_locals(file)
|
||||
output.puts "\n#{text.bold('From:')} #{file} @ line #{line_num} in #{klass}##{meth_name}:\n\n"
|
||||
|
||||
unless File.readable?(file)
|
||||
output.puts "Cannot open #{file.inspect} for reading."
|
||||
next
|
||||
end
|
||||
|
||||
# This method inspired by http://rubygems.org/gems/ir_b
|
||||
File.open(file).each_with_index do |line, index|
|
||||
|
|
Loading…
Add table
Reference in a new issue