Open zhiburt opened 3 years ago
Also might be related as I also get on one test
thread 'python' panicked at 'assertion failed: `(left == right)`
left: `4`,
right: `0`', /home/mzhiburt/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/io.rs:1700:13
And ongoing question, if you don't mind. Is it safe to do the following.
future::poll_once(self.inner.read(buf)).await
Where inner is a BufRead<async_file::File>
;
Because it just don't work, the buffer is never read :disappointed:
When I use std::fs::File
with O_NONBLOCK
it works good.
Testing it in a different project and read_line
works fine. ...
I can state that it sometimes fails and sometimes not.
p.read_line(&mut msg).await.unwrap(); // works
***
p.read_line(&mut msg).await.unwrap(); // panic on assert_debug
So moving from async-fs
to async-io
cause a different issue on the same code
thread 'python' panicked at 'assertion failed: buf.is_empty()', /home/mzhiburt/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-lite-1.12.0/src/io.rs:1699:13
Running it in --release
to disable debug_asserts drops 6 characters where were available if we would read it in a sync mode.
Hey there, so I was trying to
read_line
from aBufReader
but it producesWouldBlock
if there's no data available. What is the proper way to force the thing to wait until the data is actually there?I use
BufReader
on aasync_fs::File
By the way is it normal? https://docs.rs/futures-io/0.3.15/futures_io/trait.AsyncBufRead.html#tymethod.poll_fill_buf