You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, that's expected -- move_on_after will attempt to cancel the
operation after 1 second, but wrap_file uses threads, and since
Python/operating systems don't provide any way to cancel a thread, the
cancellation fails.
If you're on macOS/Linux and just want to read arbitrary data off stdin,
you can use trio.lowlevel.FdStream(os.dup(sys.stdin)) to get "real" async
access to stdin as a trio.abc.Stream. For more general support, we'd need
to add terminal support to Trio, which we would love to do but it's a huge
project (#174) so it hasn't
happened yet.
On Thu, Jun 1, 2023 at 11:50 PM Karen Petrosyan ***@***.***> wrote:
This code hangs until ENTER was not pressed
import sysimport trio
async def main():
with trio.move_on_after(1):
file = trio.wrap_file(sys.stdin)
async for line in file:
print(line)
trio.run(main)
—
Reply to this email directly, view it on GitHub
<#2660>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEU42BSMMA5P4YCDKV5J6LXJGEKPANCNFSM6AAAAAAYX4UTMU>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
This code hangs until ENTER was not pressed
The text was updated successfully, but these errors were encountered: