print sandbox message

Closes Homebrew/homebrew#42293.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-07-31 17:53:42 +08:00
parent 8054161153
commit 2ebd1c974b
4 changed files with 27 additions and 8 deletions

View File

@ -15,8 +15,12 @@ module Homebrew
#{formula.path}
].concat(ARGV.options_only)
if Sandbox.available? && ARGV.sandbox? && Sandbox.auto_disable?
if Sandbox.available? && ARGV.sandbox?
if Sandbox.auto_disable?
Sandbox.print_autodisable_warning
else
Sandbox.print_sandbox_message
end
end
Utils.safe_fork do

View File

@ -35,8 +35,12 @@ module Homebrew
#{f.path}
].concat(ARGV.options_only)
if Sandbox.available? && ARGV.sandbox? && Sandbox.auto_disable?
if Sandbox.available? && ARGV.sandbox?
if Sandbox.auto_disable?
Sandbox.print_autodisable_warning
else
Sandbox.print_sandbox_message
end
end
Utils.safe_fork do

View File

@ -486,8 +486,12 @@ class FormulaInstaller
#{formula.path}
].concat(build_argv)
if Sandbox.available? && ARGV.sandbox? && Sandbox.auto_disable?
if Sandbox.available? && ARGV.sandbox?
if Sandbox.auto_disable?
Sandbox.print_autodisable_warning
else
Sandbox.print_sandbox_message
end
end
Utils.safe_fork do

View File

@ -14,9 +14,16 @@ class Sandbox
end
def self.print_autodisable_warning
unless @print_autodisable_warning
unless @printed_autodisable_warning
opoo "The sandbox cannot be used in debug or interactive mode."
@print_autodisable_warning = true
@printed_autodisable_warning = true
end
end
def self.print_sandbox_message
unless @printed_sandbox_message
ohai "Using the sandbox"
@printed_sandbox_message = true
end
end