* [ruby-core:122636] [Ruby Bug#21495] IO.read_nonblock does not work under a rescue IO::TimeoutError
@ 2025-07-01 6:57 dE (dE Techno) via ruby-core
0 siblings, 0 replies; only message in thread
From: dE (dE Techno) via ruby-core @ 2025-07-01 6:57 UTC (permalink / raw)
To: ruby-core; +Cc: dE (dE Techno)
Issue #21495 has been reported by dE (dE Techno).
----------------------------------------
Bug #21495: IO.read_nonblock does not work under a rescue IO::TimeoutError
https://bugs.ruby-lang.org/issues/21495
* Author: dE (dE Techno)
* Status: Open
* ruby -v: de@myworkstation ~/docs/Practice/Software/ruby $ ruby -v ruby 3.2.8 (2025-03-26 revision 13f495dc2c) [x86_64-linux]
* Backport: 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
In this particular code --
``` ruby
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
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-07-01 6:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-01 6:57 [ruby-core:122636] [Ruby Bug#21495] IO.read_nonblock does not work under a rescue IO::TimeoutError dE (dE Techno) via ruby-core
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).