aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2015-03-10 23:26:22 -0400
committerJack Nagel2015-03-10 23:26:54 -0400
commit6895ead784e646dbcc3429ce8db14435b84c6035 (patch)
tree9a8d9d7ab5e3936818859791d2794b0b82c7550f
parent2ab8c6dac8d7c99d287285ac220f3af62a31a077 (diff)
downloadhomebrew-6895ead784e646dbcc3429ce8db14435b84c6035.tar.bz2
Reduce scope of ensure block, remove conditionals
-rw-r--r--Library/Homebrew/extend/fileutils.rb17
1 files changed, 10 insertions, 7 deletions
diff --git a/Library/Homebrew/extend/fileutils.rb b/Library/Homebrew/extend/fileutils.rb
index 76e9b610e..aa1735cb1 100644
--- a/Library/Homebrew/extend/fileutils.rb
+++ b/Library/Homebrew/extend/fileutils.rb
@@ -14,14 +14,17 @@ module FileUtils
# /tmp volume to the other volume. So we let the user override the tmp
# prefix if they need to.
- tempd = with_system_path { `mktemp -d #{HOMEBREW_TEMP}/#{prefix}-XXXXXX` }.chuzzle
- raise "Failed to create sandbox" if tempd.nil?
+ tempd = with_system_path { `mktemp -d #{HOMEBREW_TEMP}/#{prefix}-XXXXXX` }.strip
+ raise "Failed to create sandbox" if tempd.empty?
prevd = pwd
- cd tempd
- yield
- ensure
- cd prevd if prevd
- ignore_interrupts{ rm_r tempd } if tempd
+ cd(tempd)
+
+ begin
+ yield
+ ensure
+ cd(prevd)
+ ignore_interrupts { rm_r(tempd) }
+ end
end
module_function :mktemp