aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2010-01-13 05:49:52 +0000
committerMax Howell2010-01-13 11:23:15 +0000
commit700b20d66576bb6108538582f76ec880b0a0867a (patch)
tree35db50a970e5642201278c5477f5785383a4b8ff
parent1ead7d380ab85946f156ef64a0bc6324691b1704 (diff)
downloadbrew-700b20d66576bb6108538582f76ec880b0a0867a.tar.bz2
Ensure we delete temp files
It's easy to code complete with Ruby, so lets. I love Ruby.
-rw-r--r--Library/Homebrew/brew.h.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/Library/Homebrew/brew.h.rb b/Library/Homebrew/brew.h.rb
index f11448d21..2cfc47b94 100644
--- a/Library/Homebrew/brew.h.rb
+++ b/Library/Homebrew/brew.h.rb
@@ -449,9 +449,12 @@ private
# strip unlinks the file and recreates it, thus breaking hard links!
# is this expected behaviour? patch does it too… still, this fixes it
tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp
- `/usr/bin/strip #{args} -o #{tmp} #{path}`
- `/bin/cat #{tmp} > #{path}`
- File.unlink tmp
+ begin
+ `/usr/bin/strip #{args} -o #{tmp} #{path}`
+ `/bin/cat #{tmp} > #{path}`
+ ensure
+ FileUtils.rm tmp
+ end
end
end