mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
Don't raise when directory permissions don't allow file expansion.
This commit is contained in:
parent
4b52c03016
commit
c42f9af55e
2 changed files with 12 additions and 1 deletions
|
@ -81,7 +81,7 @@ class Pry
|
|||
expanded = Pathname.new(File.expand_path(file)).realpath.to_s
|
||||
# For rbx 1.9 mode [see rubinius issue #2165]
|
||||
File.exist?(expanded) ? expanded : nil
|
||||
rescue Errno::ENOENT
|
||||
rescue Errno::ENOENT, Errno::EACCES
|
||||
nil
|
||||
end
|
||||
|
||||
|
|
|
@ -37,6 +37,17 @@ describe Pry do
|
|||
end
|
||||
end
|
||||
|
||||
it "should not load the pryrc if pryrc's directory permissions do not allow this" do
|
||||
Dir.mktmpdir do |dir|
|
||||
FileUtils.chmod 0, dir
|
||||
Pry::LOCAL_RC_FILE.replace File.join(dir, '.pryrc')
|
||||
puts Pry::LOCAL_RC_FILE
|
||||
Pry.config.should_load_rc = true
|
||||
expect { Pry.start(self, :input => StringIO.new("exit-all\n"), :output => StringIO.new) }.to_not raise_error
|
||||
FileUtils.chmod 777, dir
|
||||
end
|
||||
end
|
||||
|
||||
it "should not load the pryrc if it cannot expand ENV[HOME]" do
|
||||
old_home = ENV['HOME']
|
||||
ENV['HOME'] = nil
|
||||
|
|
Loading…
Add table
Reference in a new issue