move sudo -k to formula_installer

sudo -k cannot be used inside sandbox

Closes Homebrew/homebrew#43345.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-08-28 13:08:17 +08:00
parent a5aba7f7d8
commit ddb630b01c
2 changed files with 3 additions and 3 deletions

View File

@ -168,9 +168,6 @@ begin
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
# Invalidate the current sudo timestamp in case a build script calls sudo
system "/usr/bin/sudo", "-k"
trap("INT", old_trap)
formula = ARGV.formulae.first

View File

@ -547,6 +547,9 @@ class FormulaInstaller
end
Utils.safe_fork do
# Invalidate the current sudo timestamp in case a build script calls sudo
system "/usr/bin/sudo", "-k"
if Sandbox.available? && ARGV.sandbox? && !Sandbox.auto_disable?
sandbox = Sandbox.new
formula.logs.mkpath