From: "dE (dE Techno) via ruby-core" Date: 2025-07-01T06:57:16+00:00 Subject: [ruby-core:122636] [Ruby Bug#21495] IO.read_nonblock does not work under a rescue IO::TimeoutError 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/