Actions
Bug #12087
closedFind.find に存在しないパスを渡した時のエラーにパス名がない
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
Description
ruby -rfind -e 'Find.find("/hoge"){}'
で /hoge が存在しない場合に発生するエラーが No such file or directory (Errno::ENOENT)
でパス名が含まれてません。
エラーにパス名を含めて欲しいです。次の修正で No such file or directory - /hoge (Errno::ENOENT)
となります。
diff --git a/lib/find.rb b/lib/find.rb
index aa7a3c0..093f855 100644
--- a/lib/find.rb
+++ b/lib/find.rb
@@ -41,5 +41,5 @@ def find(*paths, ignore_error: true) # :yield: path
fs_encoding = Encoding.find("filesystem")
- paths.collect!{|d| raise Errno::ENOENT unless File.exist?(d); d.dup}.each do |path|
+ paths.collect!{|d| raise Errno::ENOENT, d unless File.exist?(d); d.dup}.each do |path|
path = path.to_path if path.respond_to? :to_path
enc = path.encoding == Encoding::US_ASCII ? fs_encoding : path.encoding
Updated by nobu (Nobuyoshi Nakada) about 8 years ago
- Status changed from Open to Closed
Applied in changeset r53874.
find.rb: raise with the name
- lib/find.rb (Find#find): raise with the given path name if it
does not exist. [ruby-dev:49497] [Bug #12087]
Updated by usa (Usaku NAKAMURA) about 8 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: UNKNOWN, 2.3: UNKNOWN
Updated by usa (Usaku NAKAMURA) about 8 years ago
- Backport changed from 2.1: WONTFIX, 2.2: UNKNOWN, 2.3: UNKNOWN to 2.1: WONTFIX, 2.2: WONTFIX, 2.3: UNKNOWN
Actions
Like0
Like0Like0Like0