[ruby/rdoc] Abort with error message if --dump argument invalid
When --dump=FILE is passed a path that does not exist or is not readable, it silently fails. https://github.com/ruby/rdoc/commit/0536b83c46
This commit is contained in:
parent
79f9ed3072
commit
01aa77faa2
@ -110,10 +110,6 @@ class RDoc::RI::Driver
|
|||||||
options = default_options
|
options = default_options
|
||||||
|
|
||||||
opts = OptionParser.new do |opt|
|
opts = OptionParser.new do |opt|
|
||||||
opt.accept File do |file,|
|
|
||||||
File.readable?(file) and not File.directory?(file) and file
|
|
||||||
end
|
|
||||||
|
|
||||||
opt.program_name = File.basename $0
|
opt.program_name = File.basename $0
|
||||||
opt.version = RDoc::VERSION
|
opt.version = RDoc::VERSION
|
||||||
opt.release = nil
|
opt.release = nil
|
||||||
@ -345,9 +341,17 @@ or the PAGER environment variable.
|
|||||||
|
|
||||||
opt.separator nil
|
opt.separator nil
|
||||||
|
|
||||||
opt.on("--dump=CACHE", File,
|
opt.on("--dump=CACHE",
|
||||||
"Dump data from an ri cache or data file.") do |value|
|
"Dump data from an ri cache or data file.") do |value|
|
||||||
options[:dump_path] = value
|
unless File.readable?(value)
|
||||||
|
abort "#{value.inspect} is not readable"
|
||||||
|
end
|
||||||
|
|
||||||
|
if File.directory?(value)
|
||||||
|
abort "#{value.inspect} is a directory"
|
||||||
|
end
|
||||||
|
|
||||||
|
options[:dump_path] = File.new(value)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user