Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hirb does not recognize "/bin/cat" as a valid pager #78

Closed
ddoherty03 opened this issue May 1, 2014 · 2 comments
Closed

Hirb does not recognize "/bin/cat" as a valid pager #78

ddoherty03 opened this issue May 1, 2014 · 2 comments

Comments

@ddoherty03
Copy link

When irb is invoked in emacs with inf-ruby, it has only a dumb terminal to work with so, as a preliminary step it sets the PAGER environment variable to "/bin/cat" to effectively disable paging.
Hirb currently considers "/bin/cat" an invalid pager because it is an absolute path name. It seems it should strip the leading path first before checking its validity.

I believe this fixes it in pager.rb :

  def pager_command(*commands) #:nodoc:
     @pager_command = (!@pager_command.nil? && commands.empty?) ? @pager_command :
      begin
        env_pager = ENV['PAGER'] ? File.basename(ENV['PAGER']) : nil
        commands = [env_pager, 'less', 'more', 'pager'] if commands.empty?
        commands.compact.uniq.find {|e| Util.command_exists?(e[/\w+/]) }
      end
  end
@cldwalker
Copy link
Owner

Thanks for reporting your issue! This is one of my 17 active issues. Use that link to check how soon your issue will be answered. Don't forget to check your issue against this project's CONTRIBUTING.md. Cheers.

ddoherty03 pushed a commit to ddoherty03/hirb that referenced this issue May 4, 2014
cldwalker added a commit that referenced this issue May 27, 2014
Issuer #78: allow full path on ENV['PAGER'].
@cldwalker
Copy link
Owner

Fixed by your pull in #79

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants