Permalink
Browse files

Don't try to run the system pager if 'less' is not available.

Closes #712.
  • Loading branch information...
1 parent 6a67ea4 commit c8dc5d44a71f08704f797a3cdae5cd401e7f65eb Robert Gleeson committed Sep 15, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/pry/pager.rb
View
@@ -19,9 +19,10 @@ class Pry::Pager
def self.page(text, pager = nil)
case pager
when nil
+ `less` rescue nil
+ no_pager = $?.exitstatus != 0
is_jruby = defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
- is_windows = Pry::Helpers::BaseHelpers.windows?
- (is_jruby || is_windows) ? SimplePager.new(text).page : SystemPager.new(text).page
+ (is_jruby || no_pager) ? SimplePager.new(text).page : SystemPager.new(text).page
when :simple
SimplePager.new(text).page
when :system

0 comments on commit c8dc5d4

Please sign in to comment.