1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00

Merge pull request #1774 from MatthiasWinkelmann/realpath

Check for existance of cli_options_file before calling realpath()
This commit is contained in:
Kyrylo Silin 2018-10-01 21:25:50 +08:00 committed by GitHub
commit 9e74d5967c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -35,8 +35,10 @@ class Pry
# Load the Command line options defined by this plugin (if they exist) # Load the Command line options defined by this plugin (if they exist)
def load_cli_options def load_cli_options
cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb") cli_options_file = File.join(spec.full_gem_path, "lib/#{spec.name}/cli.rb")
return unless File.exist?(cli_options_file)
cli_options_file = File.realpath(cli_options_file) if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4") cli_options_file = File.realpath(cli_options_file) if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.4.4")
require cli_options_file if File.exist?(cli_options_file) require cli_options_file
end end
# Activate the plugin (require the gem - enables/loads the # Activate the plugin (require the gem - enables/loads the
# plugin immediately at point of call, even if plugin is # plugin immediately at point of call, even if plugin is