aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/formula_installer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/formula_installer.rb')
-rw-r--r--Library/Homebrew/formula_installer.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 38bf16996..c87972d2e 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -13,6 +13,7 @@ require 'hooks/bottles'
require 'debrew'
require 'fcntl'
require 'socket'
+require 'sandbox'
class FormulaInstaller
include FormulaCellarChecks
@@ -484,7 +485,12 @@ class FormulaInstaller
server.close
read.close
write.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
- exec(*args)
+ if Sandbox.available? && ARGV.sandbox?
+ sandbox = Sandbox.new(formula)
+ sandbox.exec(*args)
+ else
+ exec(*args)
+ end
rescue Exception => e
Marshal.dump(e, write)
write.close