Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with_timeout() cause gets() to raise Errno::ENOENT #257

Open
emiltin opened this issue Jun 30, 2023 · 4 comments
Open

with_timeout() cause gets() to raise Errno::ENOENT #257

emiltin opened this issue Jun 30, 2023 · 4 comments

Comments

@emiltin
Copy link
Contributor

emiltin commented Jun 30, 2023

Using with_timeout() makes gets() raise Errno::ENOENT. Is this correct? I would have expected Async::TimeoutError.

require 'async'
Async do |task|
  task.with_timeout(0.1) { STDIN.gets }
end

=>

  0.0s     warn: Async::Task [oid=0x64] [ec=0x78] [pid=28789] [2023-06-30 08:53:43 +0200]
               | Task may have ended with unhandled exception.
               |   Errno::ENOENT: No such file or directory @ io_fillbuf - fd:0 <STDIN>
               |   → config/private/async.rb:3 in `gets'
               |     config/private/async.rb:3 in `block (2 levels) in <main>'
               |     /Users/emiltin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.2/lib/async/scheduler.rb:317 in `with_timeout'
               |     /Users/emiltin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.2/lib/async/task.rb:126 in `with_timeout'
               |     config/private/async.rb:3 in `block in <main>'
               |     /Users/emiltin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.2/lib/async/task.rb:180 in `block in run'
               |     /Users/emiltin/.rbenv/versions/3.2.2/lib/ruby/gems/3.2.0/gems/async-2.6.2/lib/async/task.rb:350 in `block in schedule'


code/rsmp (cli_test_no_shell) % ruby -v
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
code/rsmp (cli_test_no_shell) % bundle exec gem list async

*** LOCAL GEMS ***

async (2.6.2)
async-io (1.35.0)

This is on MacOS 13.4.1.

@emiltin
Copy link
Contributor Author

emiltin commented Aug 8, 2023

Any input on this?

@ioquatix
Copy link
Member

ioquatix commented Aug 8, 2023

I'll take a look, sorry for the delayed response.

@ioquatix
Copy link
Member

ioquatix commented Aug 9, 2023

If possible, are you able to make a MVP failing test case as a PR? This will help me greatly.

@emiltin
Copy link
Contributor Author

emiltin commented Aug 9, 2023

PR in #266

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants