File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -67,16 +67,27 @@ async def stdin_reader():
67
67
continue
68
68
69
69
await read_stream_writer .send (message )
70
+ except anyio .BrokenResourceError as ex :
71
+ print (f"BrokenResourceError(reader): { ex } " )
72
+ pass
70
73
except anyio .ClosedResourceError :
71
74
await anyio .lowlevel .checkpoint ()
75
+ except Exception as ex :
76
+ print (f"read error: { ex } " )
72
77
73
78
async def stdout_writer ():
74
79
try :
75
80
async with write_stream_reader :
76
81
async for message in write_stream_reader :
77
- json = message .model_dump_json (by_alias = True , exclude_none = True )
78
- await stdout .write (json + "\n " )
79
- await stdout .flush ()
82
+ try :
83
+ json = message .model_dump_json (by_alias = True , exclude_none = True )
84
+ await stdout .write (json + "\n " )
85
+ await stdout .flush ()
86
+ except Exception as ex :
87
+ print (f"problem with writer: { ex } " )
88
+ except anyio .BrokenResourceError as ex :
89
+ print (f"BrokenResourceError(writer): { ex } " )
90
+ pass
80
91
except anyio .ClosedResourceError :
81
92
await anyio .lowlevel .checkpoint ()
82
93
You can’t perform that action at this time.
0 commit comments