diff options
author | Adam Daniels <[email protected]> | 2023-06-12 15:36:34 -0400 |
---|---|---|
committer | git <[email protected]> | 2024-05-30 00:09:22 +0000 |
commit | 01aa77faa2cd34da1f9add4d0484ab1c292ff662 (patch) | |
tree | 6a94f60aeded7946bc9739d648a0e407d2c27a28 | |
parent | 79f9ed30721d986b5b2f65efac1de4e88806f77f (diff) |
[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
-rw-r--r-- | lib/rdoc/ri/driver.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb index 64783dc163..c6fddbac67 100644 --- a/lib/rdoc/ri/driver.rb +++ b/lib/rdoc/ri/driver.rb @@ -110,10 +110,6 @@ class RDoc::RI::Driver options = default_options 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.version = RDoc::VERSION opt.release = nil @@ -345,9 +341,17 @@ or the PAGER environment variable. opt.separator nil - opt.on("--dump=CACHE", File, + opt.on("--dump=CACHE", "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 |