Actions
Bug #21495
openIO.read_nonblock does not work under a rescue IO::TimeoutError
Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [x86_64-linux]
Description
In this particular code --
execArg = 'echo testwrite; sleep 5'
tofuProcess = IO.popen(execArg, 'r')
puts 'executed tofu process.'
tofuProcess.timeout=2
begin
tofuOut = tofuProcess.read
rescue IO::TimeoutError
puts 'rescue occured'
begin
tofuOut = tofuProcess.read_nonblock(1)
rescue IO::EAGAINWaitReadable
puts 'no data in read buffer!'
end
tofuProcess.close
puts 'process closed'
end
tofuProcess.read_nonblock(1) must return a character because the underlying process has produced an output. But it raises a IO::EAGAINWaitReadable exception instead which does not happen outside a rescue IO::TimeoutError block
Actions
Like0
Like0Like0