mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
check constants (Fcntl::F_SETFL, Fcntl::F_GETFL and Fcntl::O_NONBLOCK)
instead of trapping NotImplementedError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e2e305605d
commit
4339612a14
1 changed files with 4 additions and 5 deletions
|
@ -17,12 +17,11 @@ class TestReadPartial < Test::Unit::TestCase
|
||||||
make_pipe {|r, w|
|
make_pipe {|r, w|
|
||||||
yield r, w
|
yield r, w
|
||||||
}
|
}
|
||||||
|
return unless defined?(Fcntl::F_SETFL)
|
||||||
|
return unless defined?(Fcntl::F_GETFL)
|
||||||
|
return unless defined?(Fcntl::O_NONBLOCK)
|
||||||
make_pipe {|r, w|
|
make_pipe {|r, w|
|
||||||
begin
|
r.fcntl(Fcntl::F_SETFL, r.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)
|
||||||
r.fcntl(Fcntl::F_SETFL, r.fcntl(Fcntl::F_GETFL) | Fcntl::O_NONBLOCK)
|
|
||||||
rescue NotImplementedError
|
|
||||||
break
|
|
||||||
end
|
|
||||||
yield r, w
|
yield r, w
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue