Skip to content

Commit 859ff27

Browse files
Mazyodclaude
andcommitted
fix: close stdin before process termination to prevent GC warnings
Explicitly close the subprocess stdin transport before terminating the process to prevent "Event loop is closed" errors during garbage collection. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 0a24a34 commit 859ff27

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lsp_types/process.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ async def stop(self) -> None:
130130
task.cancel()
131131

132132
if self._process:
133+
# Close stdin before terminating to prevent "Event loop is closed"
134+
# errors during garbage collection
135+
if self._process.stdin:
136+
self._process.stdin.close()
137+
133138
try:
134139
self._process.terminate()
135140
return_code = await asyncio.wait_for(self._process.wait(), timeout=5.0)

0 commit comments

Comments
 (0)