Skip to content

Commit

Permalink
be more robust to encoding errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed Sep 27, 2024
1 parent af680d6 commit 8e26c25
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyprland/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ async def read_events_loop(self) -> None:
"""Consume the event loop and calls corresponding handlers."""
while not self.stopped:
try:
data = (await self.event_reader.readline()).decode()
data = (await self.event_reader.readline()).decode(errors="replace")
except RuntimeError:
self.log.exception("Aborting event loop")
return
Expand Down
3 changes: 2 additions & 1 deletion pyprland/ipc.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ async def _get_response(command: bytes, logger: Logger) -> JSONResponse:
reader_data = await reader.read()
writer.close()
await writer.wait_closed()
return json.loads(reader_data) # type: ignore
decoded_data = reader_data.decode("utf-8", errors="replace")
return json.loads(decoded_data) # type: ignore


@retry_on_reset
Expand Down
2 changes: 1 addition & 1 deletion pyprland/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version."""

VERSION = "2.4.0-49"
VERSION = "2.4.0-52"

0 comments on commit 8e26c25

Please sign in to comment.