aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/sandbox.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/sandbox.rb')
-rw-r--r--Library/Homebrew/sandbox.rb56
1 files changed, 28 insertions, 28 deletions
diff --git a/Library/Homebrew/sandbox.rb b/Library/Homebrew/sandbox.rb
index 7ad845d5e..835ed8a25 100644
--- a/Library/Homebrew/sandbox.rb
+++ b/Library/Homebrew/sandbox.rb
@@ -39,11 +39,11 @@ class Sandbox
@profile.add_rule(rule)
end
- def allow_write(path, options={})
+ def allow_write(path, options = {})
add_rule :allow => true, :operation => "file-write*", :filter => path_filter(path, options[:type])
end
- def deny_write(path, options={})
+ def deny_write(path, options = {})
add_rule :allow => false, :operation => "file-write*", :filter => path_filter(path, options[:type])
end
@@ -79,33 +79,33 @@ class Sandbox
end
def exec(*args)
- begin
- seatbelt = Tempfile.new(["homebrew", ".sb"], HOMEBREW_TEMP)
- seatbelt.write(@profile.dump)
- seatbelt.close
- @start = Time.now
- safe_system SANDBOX_EXEC, "-f", seatbelt.path, *args
- rescue
- if ARGV.verbose?
- ohai "Sandbox profile:"
- puts @profile.dump
- end
- raise
- ensure
- seatbelt.unlink
- unless @log.nil?
- sleep 0.1 # wait for a bit to let syslog catch up the latest events.
- syslog_args = %W[
- -F '$((Time)(local))\ $(Sender)[$(PID)]:\ $Message'
- -k Time ge #{@start.to_i.to_s}
- -k Sender kernel
- -o
- -k Time ge #{@start.to_i.to_s}
- -k Sender sandboxd
- ]
- quiet_system "syslog #{syslog_args * " "} | grep deny > #{@log}"
- end
+
+ seatbelt = Tempfile.new(["homebrew", ".sb"], HOMEBREW_TEMP)
+ seatbelt.write(@profile.dump)
+ seatbelt.close
+ @start = Time.now
+ safe_system SANDBOX_EXEC, "-f", seatbelt.path, *args
+ rescue
+ if ARGV.verbose?
+ ohai "Sandbox profile:"
+ puts @profile.dump
+ end
+ raise
+ ensure
+ seatbelt.unlink
+ unless @log.nil?
+ sleep 0.1 # wait for a bit to let syslog catch up the latest events.
+ syslog_args = %W[
+ -F '$((Time)(local))\ $(Sender)[$(PID)]:\ $Message'
+ -k Time ge #{@start.to_i}
+ -k Sender kernel
+ -o
+ -k Time ge #{@start.to_i}
+ -k Sender sandboxd
+ ]
+ quiet_system "syslog #{syslog_args * " "} | grep deny > #{@log}"
end
+
end
private