summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/optparse.rb6
-rw-r--r--test/optparse/test_optparse.rb5
2 files changed, 5 insertions, 6 deletions
@@ -1056,7 +1056,7 @@ XXX
end
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"]
print = proc do |f|
@@ -1065,7 +1065,7 @@ XXX
# pager terminated
end
if Process.respond_to?(:fork) and false
- IO.popen("-") {|f| f ? Process.exec(*args, in: f) : print.call(STDOUT)}
# unreachable
end
IO.popen(*args, &print)
@@ -1107,7 +1107,7 @@ XXX
#
Officious['*-completion-zsh'] = proc do |parser|
Switch::OptionalArgument.new do |arg|
- parser.compsys(STDOUT, arg)
exit
end
end
@@ -184,10 +184,9 @@ class TestOptionParser < Test::Unit::TestCase
File.open(File.join(dir, "options.rb"), "w") do |f|
f.puts "#{<<~"begin;"}\n#{<<~'end;'}"
begin;
- stdout = STDOUT.dup
def stdout.tty?; true; end
- Object.__send__(:remove_const, :STDOUT)
- STDOUT = stdout
ARGV.options do |opt|
end;
100.times {|i| f.puts " opt.on('--opt-#{i}') {}"}