Skip to content

Commit

Permalink
Tools: Handle IO error in idf.py output capturing
Browse files Browse the repository at this point in the history
Closes #9649
  • Loading branch information
dobairoland committed Sep 5, 2022
1 parent 3423042 commit d1c61d2
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/idf_py_actions/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,14 @@ def print_progression(output: str) -> None:
print(fit_text_in_terminal(output.strip('\n\r')), end='', file=output_stream)

async def read_stream() -> Optional[str]:
output_b = await input_stream.readline()
if not output_b:
try:
output_b = await input_stream.readline()
return output_b.decode(errors='ignore')
except (asyncio.LimitOverrunError, asyncio.IncompleteReadError) as e:
print(e, file=sys.stderr)
return None
except AttributeError:
return None
return output_b.decode(errors='ignore')

async def read_interactive_stream() -> Optional[str]:
buffer = b''
Expand Down

0 comments on commit d1c61d2

Please sign in to comment.