aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-06-15 14:45:57 -0500
committerJack Nagel2012-06-15 14:48:29 -0500
commit1b6f23c8a96fcb78163ba5a58a5e0e342d390663 (patch)
tree71b14f0fcd7a82cbed9b0fa6632e95dd6d774090 /Library
parentf9b2761d7722c0e6eed91a04135f10c9ef908fdc (diff)
downloadbrew-1b6f23c8a96fcb78163ba5a58a5e0e342d390663.tar.bz2
Add comment about error pipe (mis)behavior
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rwxr-xr-xLibrary/Homebrew/build.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb
index a818cc556..b237fc447 100755
--- a/Library/Homebrew/build.rb
+++ b/Library/Homebrew/build.rb
@@ -32,6 +32,12 @@ at_exit do
# can be inconvenient for the user. But we need to be safe.
system "/usr/bin/sudo -k"
+ # The main Homebrew process expects to eventually see EOF on the error
+ # pipe in FormulaInstaller#build. However, if any child process fails to
+ # terminate (i.e, fails to close the descriptor), this won't happen, and
+ # the installer will hang. Set close-on-exec to prevent this.
+ # Whether it is *wise* to launch daemons from formulae is a separate
+ # question altogether.
if ENV['HOMEBREW_ERROR_PIPE']
require 'fcntl'
IO.new(ENV['HOMEBREW_ERROR_PIPE'].to_i, 'w').fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)