Ensure we delete temp files

It's easy to code complete with Ruby, so lets. I love Ruby.
This commit is contained in:
Max Howell 2010-01-13 05:49:52 +00:00
parent 1ead7d380a
commit 700b20d665

View File

@ -449,9 +449,12 @@ private
# strip unlinks the file and recreates it, thus breaking hard links! # strip unlinks the file and recreates it, thus breaking hard links!
# is this expected behaviour? patch does it too… still, this fixes it # is this expected behaviour? patch does it too… still, this fixes it
tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp
`/usr/bin/strip #{args} -o #{tmp} #{path}` begin
`/bin/cat #{tmp} > #{path}` `/usr/bin/strip #{args} -o #{tmp} #{path}`
File.unlink tmp `/bin/cat #{tmp} > #{path}`
ensure
FileUtils.rm tmp
end
end end
end end