diff options
| author | Jack Nagel | 2014-09-28 01:37:02 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-09-28 01:37:10 -0500 |
| commit | ef155f481899cb38bc8753db421d77fa86053aca (patch) | |
| tree | b2b40e0c49d02f440a2c91e36d269949582cea99 | |
| parent | 395d133bde8bf1820fe7cdbcddd5f9ccbbff7ec2 (diff) | |
| download | homebrew-ef155f481899cb38bc8753db421d77fa86053aca.tar.bz2 | |
Rearrange build process cleanup to avoid spawning a reader thread
This is a follow-up to bbf9f7460fc8e6e4c63f5bbe8630b11ca53f3710.
If we read from the pipe before calling Process.wait, we can avoid
spawning a thread to do the read while continuing to avoid the deadlock
that the thread was introduced to solve.
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index d457da430..c5914484c 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -505,10 +505,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 = thr.value + data = read.read read.close + Process.wait(pid) raise Marshal.load(data) unless data.nil? or data.empty? raise Interrupt if $?.exitstatus == 130 raise "Suspicious installation failure" unless $?.success? |
