Skip to content

Commit

Permalink
Read stderr from cpu count command to avoid hang
Browse files Browse the repository at this point in the history
Leaving stderr unread causes hangs.  I don't remember why, though, the
documentation somewhere probably says.

See #268
  • Loading branch information
drbrain committed Apr 15, 2014
1 parent 7875647 commit 3b71b96
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions History.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Bug fixes:
* Fixed typo, removed extra "h". Pull request #267 by Hsing-Hui Hsu.
* Rake no longer reports an error when cleaning already-deleted files. Pull
request #266 by Randy Coulman.
* Consume stderr while determining CPU count to avoid hang. Issue #268 by
Albert Sun.

=== 10.2.2 / 2014-03-27

Expand Down
4 changes: 3 additions & 1 deletion lib/rake/cpu_counter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ def count_via_sysctl
def run(command, *args)
cmd = resolve_command(command)
if cmd
Open3.popen3 cmd, *args do |_, out|
Open3.popen3 cmd, *args do |inn, out, err,|
inn.close
err.read
out.read.to_i
end
else
Expand Down

0 comments on commit 3b71b96

Please sign in to comment.