summaryrefslogtreecommitdiff
path: root/lib/rdoc/ri
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/ri')
-rw-r--r--lib/rdoc/ri/driver.rb71
1 files changed, 4 insertions, 67 deletions
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index edd2a703e7..dd66d532ca 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -7,11 +7,6 @@ begin
rescue LoadError
end
-begin
- require 'win32console'
-rescue LoadError
-end
-
require_relative '../../rdoc'
require_relative 'formatter' # For RubyGems backwards compatibility
@@ -431,9 +426,6 @@ or the PAGER environment variable.
@use_stdout = options[:use_stdout]
@show_all = options[:show_all]
@width = options[:width]
-
- # pager process for jruby
- @jruby_pager_process = nil
end
##
@@ -1050,36 +1042,6 @@ or the PAGER environment variable.
end
##
- # Finds the given +pager+ for jruby. Returns an IO if +pager+ was found.
- #
- # Returns false if +pager+ does not exist.
- #
- # Returns nil if the jruby JVM doesn't support ProcessBuilder redirection
- # (1.6 and older).
-
- def find_pager_jruby pager
- require 'java'
- require 'shellwords'
-
- return nil unless java.lang.ProcessBuilder.constants.include? :Redirect
-
- pager = Shellwords.split pager
-
- pb = java.lang.ProcessBuilder.new(*pager)
- pb = pb.redirect_output java.lang.ProcessBuilder::Redirect::INHERIT
-
- @jruby_pager_process = pb.start
-
- input = @jruby_pager_process.output_stream
-
- io = input.to_io
- io.sync = true
- io
- rescue java.io.IOException
- false
- end
-
- ##
# Finds a store that matches +name+ which can be the name of a gem, "ruby",
# "home" or "site".
#
@@ -1147,17 +1109,6 @@ or the PAGER environment variable.
end
##
- # Is +file+ in ENV['PATH']?
-
- def in_path? file
- return true if file =~ %r%\A/% and File.exist? file
-
- ENV['PATH'].split(File::PATH_SEPARATOR).any? do |path|
- File.exist? File.join(path, file)
- end
- end
-
- ##
# Lists classes known to ri starting with +names+. If +names+ is empty all
# known classes are shown.
@@ -1351,7 +1302,6 @@ or the PAGER environment variable.
yield pager
ensure
pager.close
- @jruby_pager_process.wait_for if @jruby_pager_process
end
else
yield $stdout
@@ -1519,27 +1469,14 @@ or the PAGER environment variable.
def setup_pager
return if @use_stdout
- jruby = RUBY_ENGINE == 'jruby'
-
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']
+ require 'shellwords'
pagers.compact.uniq.each do |pager|
- next unless pager
-
- pager_cmd = pager.split(' ').first
-
- next unless in_path? pager_cmd
-
- if jruby then
- case io = find_pager_jruby(pager)
- when nil then break
- when false then next
- else io
- end
- else
- io = IO.popen(pager, 'w') rescue next
- end
+ pager = Shellwords.split(pager)
+ next if pager.empty?
+ io = IO.popen(pager, 'w') rescue next
next if $? and $?.pid == io.pid and $?.exited? # pager didn't work
@paging = true