Skip to content

Commit

Permalink
Avoid breaking pry when prism is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
andrehjr committed Dec 24, 2024
1 parent 798d620 commit b347dce
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/pry/repl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,17 @@ def coolline_available?
end

def prism_available?
require 'prism'
@prism_available ||= begin
# rubocop:disable Lint/SuppressedException
begin
require 'prism'
rescue LoadError
end
# rubocop:enable Lint/SuppressedException

@prism_available ||= defined?(Prism) &&
Gem::Version.new(Prism::VERSION) >= Gem::Version.new('0.25.0')
defined?(Prism) &&
Gem::Version.new(Prism::VERSION) >= Gem::Version.new('0.25.0')
end
end

# If `$stdout` is not a tty, it's probably a pipe.
Expand Down

0 comments on commit b347dce

Please sign in to comment.