From 700b20d66576bb6108538582f76ec880b0a0867a Mon Sep 17 00:00:00 2001 From: Max Howell Date: Wed, 13 Jan 2010 05:49:52 +0000 Subject: Ensure we delete temp files It's easy to code complete with Ruby, so lets. I love Ruby. --- Library/Homebrew/brew.h.rb | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Library') 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 -- cgit v1.2.3