mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (pipe_open): erred program name should be reported by
exceptions, instead of the first argument. * process.c (rb_spawn): ditto. * process.c (proc_spawn_v): use first argument as program name. * win32/win32.c (rb_w32_aspawn): ditto. * win32/win32.c (CreateChild): search executable file if no program name given. * lib/drb/extservm.rb (invoke_service_command): use Process.spawn. [ruby-dev:23103] * lib/rdoc/ri/ri_display.rb (setup_pager): use IO.popen. [ruby-dev:23086], [ruby-dev:23103] * lib/rdoc/diagram.rb (convert_to_png): ditto. * lib/rdoc/generators/chm_generator.rb (compile_project): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
95ce90a87e
commit
5aad820604
8 changed files with 79 additions and 39 deletions
|
|
@ -196,10 +196,17 @@ class DefaultDisplay
|
|||
|
||||
def setup_pager
|
||||
unless @options.use_stdout
|
||||
require 'tempfile'
|
||||
|
||||
@save_stdout = STDOUT.clone
|
||||
STDOUT.reopen(Tempfile.new("ri_"))
|
||||
for pager in [ ENV['PAGER'], "less", "more", 'pager' ].compact.uniq
|
||||
begin
|
||||
pager = IO.popen(pager, "w")
|
||||
rescue
|
||||
else
|
||||
@save_stdout = STDOUT.clone
|
||||
STDOUT.reopen(pager)
|
||||
return
|
||||
end
|
||||
end
|
||||
@options.use_stdout = true
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -207,20 +214,8 @@ class DefaultDisplay
|
|||
|
||||
def page_output
|
||||
unless @options.use_stdout
|
||||
path = STDOUT.path
|
||||
STDOUT.reopen(@save_stdout)
|
||||
@save_stdout = nil
|
||||
paged = false
|
||||
for pager in [ ENV['PAGER'], "less", "more <", 'pager' ].compact.uniq
|
||||
if system("#{pager} #{path}")
|
||||
paged = true
|
||||
break
|
||||
end
|
||||
end
|
||||
if !paged
|
||||
@options.use_stdout = true
|
||||
puts File.read(path)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue