diff options
| author | Jack Nagel | 2014-08-08 17:31:13 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-08-08 17:31:13 -0500 |
| commit | bbf9f7460fc8e6e4c63f5bbe8630b11ca53f3710 (patch) | |
| tree | adca0f6209873ecbdede7987d15258d2a497992e /Library/Homebrew | |
| parent | f0982e4670e69f7274fdd134d9165b5d4a0c4574 (diff) | |
| download | homebrew-bbf9f7460fc8e6e4c63f5bbe8630b11ca53f3710.tar.bz2 | |
Read from the error pipe in a separate thread
If the build process tries to write more bytes than will fit in the pipe
buffer, it will block until the parent process does a read. However, the
parent process will only do a read after the child process has exited or
died, leading to a deadlock. Fix this by doing the read in a separate
thread.
Diffstat (limited to 'Library/Homebrew')
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 74b1097a8..45c70e6ce 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -515,8 +515,9 @@ class FormulaInstaller ignore_interrupts(:quietly) do # the child will receive the interrupt and marshal it back write.close + thr = Thread.new { read.read } Process.wait(pid) - data = read.read + data = thr.value read.close raise Marshal.load(data) unless data.nil? or data.empty? raise Interrupt if $?.exitstatus == 130 |
