We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
StdioServer.write
anyio.to_thread.run_sync
1 parent 47badae commit e240d70Copy full SHA for e240d70
lf_toolkit/io/stdio_server.py
@@ -2,6 +2,7 @@
2
3
from typing import Optional
4
5
+import anyio
6
from anyio.streams.file import FileReadStream
7
from anyio.streams.file import FileWriteStream
8
from anyio.streams.stapled import StapledByteStream
@@ -25,7 +26,7 @@ async def read(self, size: int) -> bytes:
25
26
27
async def write(self, data: bytes):
28
await self.stream.send(data)
- await self.stream.flush()
29
+ await anyio.to_thread.run_sync(sys.stdout.buffer.flush)
30
31
async def close(self):
32
await self.stream.aclose()
0 commit comments