Skip to content

Commit

Permalink
Merge pull request #17377 from samford/cask-audit-rework-tmpdir-removal
Browse files Browse the repository at this point in the history
cask/audit: Rework tmpdir removal
  • Loading branch information
MikeMcQuaid authored May 27, 2024
2 parents 44d0d64 + e2220ec commit 92adf6a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Library/Homebrew/cask/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ def initialize(
@token_conflicts = token_conflicts
@only = only || []
@except = except || []

# Clean up `#extract_artifacts` tmp dir when Audit object is destroyed
ObjectSpace.define_finalizer(
self,
proc { FileUtils.remove_entry(@tmpdir) if @tmpdir },
)
end

def run!
Expand Down Expand Up @@ -540,6 +534,12 @@ def extract_artifacts

@tmpdir ||= Pathname(Dir.mktmpdir("cask-audit", HOMEBREW_TEMP))

# Clean up tmp dir when @tmpdir object is destroyed
ObjectSpace.define_finalizer(
@tmpdir,
proc { FileUtils.remove_entry(@tmpdir) },
)

ohai "Downloading and extracting artifacts"

downloaded_path = download.fetch
Expand Down

0 comments on commit 92adf6a

Please sign in to comment.