From 3bbbc5ac84c7e1b5bf21373b560b3ed500fda97d Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 4 Jun 2022 14:39:07 +0900 Subject: [PATCH 1/3] Stop checking if pager command found `IO.popen` does that job. --- lib/rdoc/ri/driver.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index edd2a703e7..61eec382f3 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1526,10 +1526,6 @@ def setup_pager 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 From ce63794fde44b31293ee79015a3f2d17b01cfd3f Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 4 Jun 2022 16:13:36 +0900 Subject: [PATCH 2/3] Enable pager tests --- test/rdoc/test_rdoc_ri_driver.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 5f3468c368..18f92d0168 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -1246,7 +1246,7 @@ def test_load_method_missing assert_equal '(unknown)#inherit', method.full_name end - def _test_page # this test doesn't do anything anymore :( + def test_page @driver.use_stdout = false with_dummy_pager do @@ -1260,9 +1260,7 @@ def _test_page # this test doesn't do anything anymore :( refute @driver.paging? end - # this test is too fragile. Perhaps using Process.spawn will make this - # reliable - def _test_page_in_presence_of_child_status + def test_page_in_presence_of_child_status @driver.use_stdout = false with_dummy_pager do @@ -1425,7 +1423,7 @@ def test_parse_name_special end end - def _test_setup_pager # this test doesn't do anything anymore :( + def test_setup_pager # this test doesn't do anything anymore :( @driver.use_stdout = false pager = with_dummy_pager do @driver.setup_pager end From 83051403d6f9666c99fdb58467b05b28f0d9ec8a Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sat, 4 Jun 2022 16:14:26 +0900 Subject: [PATCH 3/3] Remove `RDoc::RI::Driver#in_path?` --- lib/rdoc/ri/driver.rb | 11 ----------- test/rdoc/test_rdoc_ri_driver.rb | 17 ----------------- 2 files changed, 28 deletions(-) diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 61eec382f3..3cfc34d243 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -1146,17 +1146,6 @@ def interactive exit 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. diff --git a/test/rdoc/test_rdoc_ri_driver.rb b/test/rdoc/test_rdoc_ri_driver.rb index 18f92d0168..c23fe63130 100644 --- a/test/rdoc/test_rdoc_ri_driver.rb +++ b/test/rdoc/test_rdoc_ri_driver.rb @@ -1091,23 +1091,6 @@ def tty.tty?() true; end assert_instance_of @RM::ToBs, driver.formatter(StringIO.new) end - def test_in_path_eh - path = ENV['PATH'] - - test_path = File.expand_path '..', __FILE__ - - temp_dir do |dir| - nonexistent = File.join dir, 'nonexistent' - refute @driver.in_path?(nonexistent) - - ENV['PATH'] = test_path - - assert @driver.in_path?(File.basename(__FILE__)) - end - ensure - ENV['PATH'] = path - end - def test_method_type assert_equal :both, @driver.method_type(nil) assert_equal :both, @driver.method_type('.')