From b5c68b60bd408a4e14cd58ac0410b0a7444610c2 Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 10 Jul 2005 15:17:35 +0000 Subject: * lib/pathname.rb (Pathname#unlink): try Dir.unlink first to avoid unlink a directory by root. cf. [ruby-dev:26237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@8743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/pathname.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/pathname.rb') diff --git a/lib/pathname.rb b/lib/pathname.rb index b7cc01edb3..b21abd746b 100644 --- a/lib/pathname.rb +++ b/lib/pathname.rb @@ -861,9 +861,9 @@ class Pathname # * mixed * # Dir.unlink as necessary. def unlink() begin - File.unlink @path - rescue SystemCallError Dir.unlink @path + rescue Errno::ENOTDIR + File.unlink @path end end alias delete unlink -- cgit v1.2.3