Skip to content

Commit

Permalink
Merge pull request #2571 from danielmartin/revert-2517-fix-select-blo…
Browse files Browse the repository at this point in the history
…cking

Revert "Fix `IO#select` blocking."
  • Loading branch information
reitermarkus committed May 1, 2017
2 parents 0c9047a + a98991a commit 8cba035
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Library/Homebrew/cask/lib/hbc/system_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,25 +92,17 @@ def write_input_to(raw_stdin)

def each_line_from(sources)
loop do
selected_sources = IO.select(sources, [], [], 10)

break if selected_sources.nil?

readable_sources = selected_sources[0].delete_if(&:eof?)

readable_sources.each do |source|
readable_sources = IO.select(sources)[0]
readable_sources.delete_if(&:eof?).first(1).each do |source|
type = (source == sources[0] ? :stdout : :stderr)

begin
yield(type, source.readline_nonblock || "")
rescue IO::WaitReadable, EOFError
next
end
end

break if readable_sources.empty?
end

sources.each(&:close_read)
end

Expand Down

0 comments on commit 8cba035

Please sign in to comment.