Commit 2cd08fd
committed
fix: detect stdin EOF on parent death for stdio transport
Add a background monitor that uses select.poll() to detect POLLHUP on
stdin's file descriptor. When the parent process dies and the pipe's
write end closes, the monitor cancels the task group, triggering a
clean shutdown.
The anyio.wrap_file async iterator may not propagate EOF promptly
because it runs readline() in a worker thread. The poll-based monitor
detects the hang-up at the OS level independent of the worker thread.
Only enabled on non-Windows platforms where select.poll() is available.1 parent 31a38b5 commit 2cd08fd
1 file changed
+49
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
31 | 75 | | |
32 | 76 | | |
33 | 77 | | |
| |||
80 | 124 | | |
81 | 125 | | |
82 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
83 | 132 | | |
0 commit comments