Does it fix ri bug related to PAGER in WinMe [ruby-talk:103662]?
I must have missed this one. But unfortunately I don't have an ME box
to try it on anyway. If you could send me a detailed description, I can
try to fix it "in theory" and you can be my testing department
Here's what I do to track down the problem.
I use the latest ruby182-14_rc5.exe from Ruby Installer on rubyforge.
First I add some debug info to ri_display.rb
=============================================================================
--- ri_display.rb.orig 2004-03-25 22:31:10.000000000 +0700
+++ ri_display.rb 2004-07-26 16:35:30.000000000 +0700
@@ -223,11 +223,16 @@
@save_stdout = nil
paged = false
for pager in [ ENV['PAGER'], "less", "more <", 'pager' ].compact.uniq
+STDERR.puts "#{pager} #{path}"
if system("#{pager} #{path}")
paged = true
break
end
end
+STDERR.puts "paged: #{paged}"
+STDERR.print 'Press Enter'
+STDERR.flush
+STDIN.readline
if !paged
@options.use_stdout = true
puts File.read(path)
=============================================================================
The I try to run ri in DOS Prompt
=============================================================================
C:\WINDOWS\Desktop>ri String
less C:/WINDOWS/TEMP/ri_256695.0
more < C:/WINDOWS/TEMP/ri_256695.0
File not found
paged: true
Press Enter
=============================================================================
The problem is in system("more < file"). I try similar thing with irb
=============================================================================
irb(main):001:0> system "more < c:\autoexec.bat"
File not found
=> true
=============================================================================
Same result.
I did more experiment on irb
=============================================================================
irb(main):002:0> system 'more c:\autoexec.bat'
=> false
irb(main):003:0> system 'more.com c:\autoexec.bat'
SET windir=C:\WINDOWS
SET winbootdir=C:\WINDOWS
SET COMSPEC=C:\WINDOWS\COMMAND.COM
SET PROMPT=$p$g
SET TEMP=C:\WINDOWS\TEMP
SET TMP=C:\WINDOWS\TEMP
SET TCL_LIBRARY=c:\ruby\tcl\lib\tcl8.3
SET RUBY_TCL_DLL=c:\ruby\bin\tcl83.dll
SET RUBY_TK_DLL=c:\ruby\bin\tk83.dll
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;c:\ruby\bin
=> true
irb(main):004:0> system 'more.com < c:\autoexec.bat'
SET windir=C:\WINDOWS
SET winbootdir=C:\WINDOWS
SET COMSPEC=C:\WINDOWS\COMMAND.COM
SET PROMPT=$p$g
SET TEMP=C:\WINDOWS\TEMP
SET TMP=C:\WINDOWS\TEMP
SET TCL_LIBRARY=c:\ruby\tcl\lib\tcl8.3
SET RUBY_TCL_DLL=c:\ruby\bin\tcl83.dll
SET RUBY_TK_DLL=c:\ruby\bin\tk83.dll
SET PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;c:\ruby\bin
=> true
=============================================================================
It appear I must use 'more.com'. So I add 'more.com' before 'more <'
=============================================================================
for pager in [ ENV['PAGER'], "less", "more.com", "more <", 'pager' ].compact.uniq
=============================================================================
Here's the result
=============================================================================
C:\WINDOWS\Desktop>ri String
less C:/WINDOWS/TEMP/ri_256695.0
more.com C:/WINDOWS/TEMP/ri_256695.0
Invalid switch
paged: true
Press Enter
=============================================================================
I believe that because the path is in UNIX style, so 'more' think it is a
DOS style command-line switch (/something).
The question is:
1. Why system('more') doesn't find more.com?
2. Why the path is in UNIX style?
3. How to change it to DOS style?
Wassallam,
-- Zakaria
(e-mail address removed) Yahoo!: z4k4ri4
http://zakaria.is-a-geek.org
http://pemula.linux.or.id