mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
mktemp: drop include FileUtils
This commit is contained in:
parent
e021a6b7dd
commit
e8f9dfc3e9
@ -5,8 +5,6 @@
|
|||||||
# Each instance is only intended to be used once.
|
# Each instance is only intended to be used once.
|
||||||
# Can also be used to create a temporary directory with the brew instance's group.
|
# Can also be used to create a temporary directory with the brew instance's group.
|
||||||
class Mktemp
|
class Mktemp
|
||||||
include FileUtils
|
|
||||||
|
|
||||||
# Path to the tmpdir used in this run
|
# Path to the tmpdir used in this run
|
||||||
sig { returns(T.nilable(Pathname)) }
|
sig { returns(T.nilable(Pathname)) }
|
||||||
attr_reader :tmpdir
|
attr_reader :tmpdir
|
||||||
@ -106,11 +104,11 @@ class Mktemp
|
|||||||
sig { params(path: Pathname).void }
|
sig { params(path: Pathname).void }
|
||||||
def chmod_rm_rf(path)
|
def chmod_rm_rf(path)
|
||||||
if path.directory? && !path.symlink?
|
if path.directory? && !path.symlink?
|
||||||
chmod("u+rw", path) if path.owned? # Need permissions in order to see the contents
|
FileUtils.chmod("u+rw", path) if path.owned? # Need permissions in order to see the contents
|
||||||
path.children.each { |child| chmod_rm_rf(child) }
|
path.children.each { |child| chmod_rm_rf(child) }
|
||||||
rmdir(path)
|
FileUtils.rmdir(path)
|
||||||
else
|
else
|
||||||
rm_f(path)
|
FileUtils.rm_f(path)
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
nil # Just skip this directory.
|
nil # Just skip this directory.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user