Skip to content

Commit 4ac4d6b

Browse files
authored
Merge pull request #1104 from adam12/ri-dump-silent-failure
Abort with error message if `--dump` argument invalid
2 parents 546363d + 0536b83 commit 4ac4d6b

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

lib/rdoc/ri/driver.rb

+10-6
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,6 @@ def self.process_args argv
110110
options = default_options
111111

112112
opts = OptionParser.new do |opt|
113-
opt.accept File do |file,|
114-
File.readable?(file) and not File.directory?(file) and file
115-
end
116-
117113
opt.program_name = File.basename $0
118114
opt.version = RDoc::VERSION
119115
opt.release = nil
@@ -345,9 +341,17 @@ def self.process_args argv
345341

346342
opt.separator nil
347343

348-
opt.on("--dump=CACHE", File,
344+
opt.on("--dump=CACHE",
349345
"Dump data from an ri cache or data file.") do |value|
350-
options[:dump_path] = value
346+
unless File.readable?(value)
347+
abort "#{value.inspect} is not readable"
348+
end
349+
350+
if File.directory?(value)
351+
abort "#{value.inspect} is a directory"
352+
end
353+
354+
options[:dump_path] = File.new(value)
351355
end
352356
end
353357

0 commit comments

Comments
 (0)