Skip to content

Commit

Permalink
detach from coroutine for shorter and when not finding output
Browse files Browse the repository at this point in the history
TODO: Is shorter or longer timeout in the new location better?
  • Loading branch information
pevogam committed Mar 28, 2023
1 parent 6a4f770 commit 4eaf9a1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion aexpect/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,7 +840,8 @@ async def _read_nonblocking_async(self, internal_timeout=None, timeout=None):
return read, data
if end_time and time.time() > end_time:
return read, data
await asyncio.sleep(1)
# TODO: sleeping for long here slows down the async command too much
#await asyncio.sleep(1)

def read_nonblocking(self, internal_timeout=None, timeout=None):
"""
Expand Down Expand Up @@ -1001,6 +1002,7 @@ async def read_until_output_matches_async(self, patterns, filter_func=lambda x:
match = match_func(filter_func(output), patterns)
if match is not None:
return match, output
await asyncio.sleep(0.1)

# Check if the child has terminated
if utils_wait.wait_for(lambda: not self.is_alive(), 5, 0, 0.1):
Expand Down

0 comments on commit 4eaf9a1

Please sign in to comment.