Commit 1a634ca
fix(claude-code): drain stderr in tutorial _spawn_claude to avoid deadlock [greptile]
All three claude-code tutorial spawn helpers pass --verbose and capture stderr
via asyncio.subprocess.PIPE but never read it. A non-trivial session can write
enough verbose output to fill the OS pipe buffer, at which point Claude Code
blocks on its stderr write while we block reading stdout — a hard deadlock.
Drain stderr in a concurrent background task (awaited after proc.wait()) so
stdout never stalls. Applied to 060_claude_code (sync), 130_claude_code
(async base), and 140_claude_code (temporal).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 3a39c5a commit 1a634ca
3 files changed
Lines changed: 36 additions & 0 deletions
File tree
- examples/tutorials
- 00_sync/060_claude_code/project
- 10_async
- 00_base/130_claude_code/project
- 10_temporal/140_claude_code/project
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
71 | 82 | | |
72 | 83 | | |
73 | 84 | | |
| |||
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
| 95 | + | |
84 | 96 | | |
85 | 97 | | |
86 | 98 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
72 | 83 | | |
73 | 84 | | |
74 | 85 | | |
| |||
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
89 | 100 | | |
90 | 101 | | |
91 | 102 | | |
| |||
99 | 110 | | |
100 | 111 | | |
101 | 112 | | |
| 113 | + | |
102 | 114 | | |
103 | 115 | | |
104 | 116 | | |
| |||
0 commit comments