Project

General

Profile

Actions

Bug #12087

closed

Find.find に存在しないパスを渡した時のエラーにパス名がない

Added by tommy (Masahiro Tomita) about 8 years ago. Updated almost 8 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
[ruby-dev:49497]

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
Actions #1

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

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) almost 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

Also available in: Atom PDF

Like0
Like0Like0Like0