mxcl/homebrew — pull request #12160 by jacknagel (2012-05-09 02:57:12+00:00)
Title: Set close-on-exec on the error pipe

We use a pipe to marshal exceptions from the build script back to the
main Homebrew process; the associated file descriptor is stored in an
environment variable so that the script can figure out which descriptor
to use after being exec'd.

However, any child processes of the build script inherit this
descriptor (i.e. anything spawned via "system" by the formula during
installation). Normally this is not an issue, but if a formula executes
a long-running process such as a daemon, the main Homebrew process will
never see EOF on the error pipe because the daemon still has an open
descriptor.

We can fix this while preserving current behavior by setting the
close-on-exec flag on the build script's error pipe descriptor.

---

See #12135 (the thread is misnamed, system actually *does* return).