mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
f29d43a3ec
commit
e3503ee218
2 changed files with 3 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue