-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Ruby IO streams can be set to nonblock by using the fcntl library and calling IO#fcntl as shown below:
require 'fcntl'
# get current flags
flags = write.fcntl(Fcntl::F_GETFL)
# set O_NONBLOCK flag
write.fcntl(Fcntl::F_SETFL, flags | (Fcntl::O_NONBLOCK))
# clear O_NONBLOCK flag
write.fcntl(Fcntl::F_SETFL, flags & (~Fcntl::O_NONBLOCK))Our logic should be calling the NIO setBlocking with true when O_NONBLOCK flag is zero and with false when O_NONBLOCK is nonzero, but we have it reversed:
jruby/core/src/main/java/org/jruby/RubyIO.java
Lines 2666 to 2670 in a37fb3f
| if ((nArg & OpenFlags.O_NONBLOCK.intValue()) != 0) { | |
| fptr.setBlocking(runtime, true); | |
| } else { | |
| fptr.setBlocking(runtime, false); | |
| } |
This is obviously wrong, but inconveniently also messes up the workaround for #8069.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels