See #2167. This should make all platforms equal now in terms of how read selects are handled. It looks like OS X needs the same workaround as Windows

git-svn-id: file:///home/svn/framework3/trunk@9641 4d416f70-5f16-0410-b530-b9f4589650da
unstable
HD Moore 2010-07-01 14:49:49 +00:00
parent 23651de9dd
commit 864fcafb4a
1 changed files with 5 additions and 15 deletions

View File

@ -73,22 +73,12 @@ module Stream
#
def has_read_data?(timeout = nil)
begin
if RUBY_VERSION =~ /^1\.9\./ and RUBY_PLATFORM !~ /cygwin|mingw32/
if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and
(rv[0]) and
(rv[0][0] == fd))
true
else
false
end
if ((rv = ::IO.select([ fd ], nil, nil, timeout)) and
(rv[0]) and
(rv[0][0] == fd))
true
else
if ((rv = Rex::ThreadSafe.select([ fd ], nil, nil, timeout)) and
(rv[0]) and
(rv[0][0] == fd))
true
else
false
end
false
end
rescue StreamClosedError, ::IOError, ::EOFError, ::Errno::EPIPE
# If the thing that lead to the closure was an abortive close, then