1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in

rescue LoadError on 'etc'.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2014-04-29 03:51:13 +00:00
parent cce5fe1ae5
commit 17a4a9b993
2 changed files with 32 additions and 39 deletions

View file

@ -1,3 +1,8 @@
Tue Apr 29 12:50:02 2014 Tanaka Akira <akr@fsij.org>
* lib/fileutils.rb: Don't need to define fu_get_gid and fu_get_gid in
rescue LoadError on 'etc'.
Tue Apr 29 10:21:38 2014 Kazuki Tsujimoto <kazuki@callcc.net>
* parse.y (symbols_i): like r45492, call rb_gc_resurrect().

View file

@ -1097,47 +1097,35 @@ module FileUtils
begin
require 'etc'
def fu_get_uid(user) #:nodoc:
return nil unless user
case user
when Integer
user
when /\A\d+\z/
user.to_i
else
Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
end
end
private_module_function :fu_get_uid
def fu_get_gid(group) #:nodoc:
return nil unless group
case group
when Integer
group
when /\A\d+\z/
group.to_i
else
Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
end
end
private_module_function :fu_get_gid
rescue LoadError
# need Win32 support???
def fu_get_uid(user) #:nodoc:
user # FIXME
end
private_module_function :fu_get_uid
def fu_get_gid(group) #:nodoc:
group # FIXME
end
private_module_function :fu_get_gid
rescue LoadError # rescue LoadError for miniruby
end
def fu_get_uid(user) #:nodoc:
return nil unless user
case user
when Integer
user
when /\A\d+\z/
user.to_i
else
Etc.getpwnam(user) ? Etc.getpwnam(user).uid : nil
end
end
private_module_function :fu_get_uid
def fu_get_gid(group) #:nodoc:
return nil unless group
case group
when Integer
group
when /\A\d+\z/
group.to_i
else
Etc.getgrnam(group) ? Etc.getgrnam(group).gid : nil
end
end
private_module_function :fu_get_gid
#
# Options: noop verbose
#