make some operations more robust
This commit is contained in:
parent
c710e76912
commit
43619bc1ca
1 changed files with 6 additions and 2 deletions
|
@ -82,11 +82,15 @@ class Pyprland:
|
|||
async def read_events_loop(self):
|
||||
"Consumes the event loop and calls corresponding handlers"
|
||||
while not self.stopped:
|
||||
data = (await self.event_reader.readline()).decode()
|
||||
try:
|
||||
data = (await self.event_reader.readline()).decode()
|
||||
except UnicodeDecodeError:
|
||||
self.log.error("Invalid unicode while reading events")
|
||||
continue
|
||||
if not data:
|
||||
self.log.critical("Reader starved")
|
||||
return
|
||||
cmd, params = data.split(">>")
|
||||
cmd, params = data.split(">>", 1)
|
||||
full_name = f"event_{cmd}"
|
||||
|
||||
await self._callHandler(full_name, params)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue