Skip to content

Commit 94e0ded

Browse files
committed
Fix blocking read syscall
1 parent 81994d9 commit 94e0ded

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/ruby/truffleruby/core/posix.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,10 @@ def self.execute_posix_read_with_timeout(io, buffer, length)
433433
deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) + timeout_milliseconds
434434

435435
while true
436+
nonblock_old = io.nonblock?
437+
io.nonblock = true
436438
bytes_read = Truffle::POSIX.read(fd, buffer, length)
439+
io.nonblock = nonblock_old
437440
return bytes_read if bytes_read >= 0
438441
return bytes_read unless Errno.errno == Errno::EAGAIN::Errno
439442

0 commit comments

Comments
 (0)