Permalink
Browse files

On ENOENT, use the simple pager.

  • Loading branch information...
1 parent 21d0f65 commit faa388b94f4aab449636f87d0a33c077856c3bd3 Robert Gleeson committed Aug 9, 2012
Showing with 13 additions and 4 deletions.
  1. +1 −1 lib/pry/helpers/base_helpers.rb
  2. +12 −3 lib/pry/pager.rb
@@ -140,7 +140,7 @@ def stagger_output(text, out = nil)
Pry::Pager.page(text)
end
rescue Errno::ENOENT
- Pry::Pager.page(text)
+ Pry::Pager.page(text, :simple)
rescue Errno::EPIPE
end
View
@@ -3,9 +3,18 @@ def self.page_size
27
end
- def self.page(text)
- is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
- is_jruby ? SimplePager.new(text).page : SystemPager.new(text).page
+ def self.page(text, pager = nil)
+ case pager
+ when nil
+ is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
+ is_jruby ? SimplePager.new(text).page : SystemPager.new(text).page
+ when :simple
+ SimplePager.new(text).page
+ when :system
+ SystemPager.new(text).page
+ else
+ raise "'#{pager}' is not a recongized pager."
+ end
end
def page

0 comments on commit faa388b

Please sign in to comment.