mirror of
https://github.com/esphome/esphome.git
synced 2026-09-02 02:56:01 +00:00
Fix line callbacks not firing when no filter_lines set
The line buffering and callback processing only ran when a filter pattern was configured. Enter the line processing branch whenever line_callbacks are registered too.
This commit is contained in:
+5
-2
@@ -162,7 +162,7 @@ class RedirectText:
|
||||
if not isinstance(s, str):
|
||||
s = s.decode()
|
||||
|
||||
if self._filter_pattern is not None:
|
||||
if self._filter_pattern is not None or self._line_callbacks:
|
||||
self._line_buffer += s
|
||||
lines = self._line_buffer.splitlines(True)
|
||||
for line in lines:
|
||||
@@ -174,7 +174,10 @@ class RedirectText:
|
||||
|
||||
line_without_ansi = ANSI_ESCAPE.sub("", line)
|
||||
line_without_end = line_without_ansi.rstrip()
|
||||
if self._filter_pattern.match(line_without_end) is not None:
|
||||
if (
|
||||
self._filter_pattern is not None
|
||||
and self._filter_pattern.match(line_without_end) is not None
|
||||
):
|
||||
# Filter pattern matched, ignore the line
|
||||
continue
|
||||
|
||||
|
||||
Reference in New Issue
Block a user