зеркало из https://github.com/github/ruby.git
Octal mode in un.rb
* lib/fileutils.rb (FileUtils#symbolic_modes_to_i): revert r55524. * lib/un.rb (install, chmod): support octal mode string. fix up r55513. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
f29d43a3ec
Коммит
e3503ee218
|
@ -812,7 +812,6 @@ module FileUtils
|
|||
private_module_function :apply_mask
|
||||
|
||||
def symbolic_modes_to_i(mode_sym, path) #:nodoc:
|
||||
return mode_sym.oct if /\A[0-7]+\z/ =~ mode_sym
|
||||
mode = if File::Stat === path
|
||||
path.mode
|
||||
else
|
||||
|
|
|
@ -196,7 +196,7 @@ end
|
|||
|
||||
def install
|
||||
setup("pm:o:g:") do |argv, options|
|
||||
(mode = options.delete :m) and options[:mode] = mode
|
||||
(mode = options.delete :m) and options[:mode] = /\A\d/ =~ mode ? mode.oct : mode
|
||||
options[:preserve] = true if options.delete :p
|
||||
(owner = options.delete :o) and options[:owner] = owner
|
||||
(group = options.delete :g) and options[:group] = group
|
||||
|
@ -216,7 +216,8 @@ end
|
|||
|
||||
def chmod
|
||||
setup do |argv, options|
|
||||
mode = argv.shift.oct
|
||||
mode = argv.shift
|
||||
mode = /\A\d/ =~ mode ? mode.oct : mode
|
||||
FileUtils.chmod mode, argv, options
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче