diff options
| author | Xu Cheng | 2015-04-13 18:16:27 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-04-15 19:51:54 +0800 |
| commit | d1617e86d0ab3c9ee4742c9be1dd913b50b716fd (patch) | |
| tree | e23633a0cc11973b419108f0b14444cc9f278534 /Library/Homebrew/postinstall.rb | |
| parent | b621edf89dba704f7165fff0f0311f9e0c05bc34 (diff) | |
| download | brew-d1617e86d0ab3c9ee4742c9be1dd913b50b716fd.tar.bz2 | |
sandbox postinstall
Closes Homebrew/homebrew#38479.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/postinstall.rb')
| -rw-r--r-- | Library/Homebrew/postinstall.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Library/Homebrew/postinstall.rb b/Library/Homebrew/postinstall.rb new file mode 100644 index 000000000..14e578128 --- /dev/null +++ b/Library/Homebrew/postinstall.rb @@ -0,0 +1,21 @@ +old_trap = trap("INT") { exit! 130 } + +require "global" +require "debrew" +require "fcntl" +require "socket" + +begin + error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) + error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) + + trap("INT", old_trap) + + formula = ARGV.formulae.first + formula.extend(Debrew::Formula) if ARGV.debug? + formula.run_post_install +rescue Exception => e + Marshal.dump(e, error_pipe) + error_pipe.close + exit! 1 +end |
