aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2012-06-15 14:45:57 -0500
committerJack Nagel2012-06-15 14:48:29 -0500
commit4302dc3526282344dc89d9e3b541a50aabcecc0f (patch)
treef25788959bdc69ecc1f6d2e58806a9a41ec4d846
parenta75c91be98362849008f38a2c7e2e46a3361ab5a (diff)
downloadhomebrew-4302dc3526282344dc89d9e3b541a50aabcecc0f.tar.bz2
Add comment about error pipe (mis)behavior
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
-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)