mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
[ruby/optparse] Fix LESS environment variable setup in OptionParser#help_exit
If the original value of LESS ends with an option starting with "--",
simply appending "Fe" would result in an invalid option string.
30571f91d3
This commit is contained in:
parent
f4c16c57aa
commit
3cd3f76679
1 changed files with 1 additions and 1 deletions
|
@ -1058,7 +1058,7 @@ XXX
|
|||
def help_exit
|
||||
if $stdout.tty? && (pager = ENV.values_at(*%w[RUBY_PAGER PAGER]).find {|e| e && !e.empty?})
|
||||
less = ENV["LESS"]
|
||||
args = [{"LESS" => "#{!less || less.empty? ? '-' : less}Fe"}, pager, "w"]
|
||||
args = [{"LESS" => "#{less} -Fe"}, pager, "w"]
|
||||
print = proc do |f|
|
||||
f.puts help
|
||||
rescue Errno::EPIPE
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue