Skip to content

Commit ad4e2b6

Browse files
committed
fix: add __aiter__ to AsyncCommandHandle for async iteration support
The sync CommandHandle supports `for stdout, stderr, pty in handle:` via __iter__, but AsyncCommandHandle lacks __aiter__, preventing `async for stdout, stderr, pty in handle:` usage. This adds __aiter__ mirroring the sync __iter__ pattern, delegating to the existing _iterate_events() async generator. Related to #1034 AI Disclosure: This commit was authored by Claude Opus 4.6 (Anthropic), operated by Maxwell Calkin (@MaxwellCalkin).
1 parent d289772 commit ad4e2b6

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

packages/python-sdk/e2b/sandbox_async/commands/command_handle.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ def __init__(
9999

100100
self._wait = asyncio.create_task(self._handle_events())
101101

102+
def __aiter__(self):
103+
"""
104+
Iterate over the command output asynchronously.
105+
106+
:return: Async generator of command outputs
107+
"""
108+
return self._iterate_events().__aiter__()
109+
102110
async def _iterate_events(
103111
self,
104112
) -> AsyncGenerator[

0 commit comments

Comments
 (0)