mirror of
https://github.com/esphome/esphome.git
synced 2025-02-12 07:58:17 +00:00
Merge branch 'remove_codecs' into integration
This commit is contained in:
commit
ae31d75cbd
@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import base64
|
||||
import binascii
|
||||
import codecs
|
||||
import collections
|
||||
import datetime
|
||||
import functools
|
||||
@ -345,8 +344,8 @@ class EsphomeCommandWebSocket(tornado.websocket.WebSocketHandler):
|
||||
async def handle_stdin(self, json_message: dict[str, Any]) -> None:
|
||||
if not self.is_process_active:
|
||||
return
|
||||
data = json_message["data"]
|
||||
data = codecs.encode(data, "utf8", "replace")
|
||||
text: str = json_message["data"]
|
||||
data = text.encode("utf-8", "replace")
|
||||
_LOGGER.debug("< stdin: %s", data)
|
||||
self._proc.stdin.write(data)
|
||||
|
||||
@ -357,18 +356,18 @@ class EsphomeCommandWebSocket(tornado.websocket.WebSocketHandler):
|
||||
while True:
|
||||
try:
|
||||
if self._use_popen:
|
||||
data = yield self._queue.get()
|
||||
data: bytes = yield self._queue.get()
|
||||
if data is None:
|
||||
self._proc_on_exit(self._proc.poll())
|
||||
break
|
||||
else:
|
||||
data = yield self._proc.stdout.read_until_regex(reg)
|
||||
data: bytes = yield self._proc.stdout.read_until_regex(reg)
|
||||
except tornado.iostream.StreamClosedError:
|
||||
break
|
||||
data = codecs.decode(data, "utf8", "replace")
|
||||
|
||||
_LOGGER.debug("> stdout: %s", data)
|
||||
self.write_message({"event": "line", "data": data})
|
||||
text = data.decode("utf-8", "replace")
|
||||
_LOGGER.debug("> stdout: %s", text)
|
||||
self.write_message({"event": "line", "data": text})
|
||||
|
||||
def _stdout_thread(self) -> None:
|
||||
if not self._use_popen:
|
||||
|
Loading…
x
Reference in New Issue
Block a user