Skip to content
2 changes: 1 addition & 1 deletion airflow/hooks/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def pre_exec():
raise RuntimeError("The subprocess should be created here and is None!")
if self.sub_process.stdout is not None:
for raw_line in iter(self.sub_process.stdout.readline, b''):
line = raw_line.decode(output_encoding).rstrip()
line = raw_line.decode(output_encoding, errors='backslashreplace').rstrip()
self.log.info("%s", line)

self.sub_process.wait()
Expand Down
3 changes: 2 additions & 1 deletion airflow/providers/cncf/kubernetes/utils/pod_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,8 @@ def follow_logs(since_time: Optional[DateTime] = None) -> Optional[DateTime]:
),
)
for line in logs:
timestamp, message = self.parse_log_line(line.decode('utf-8'))
line = line.decode('utf-8', errors="backslashreplace")
timestamp, message = self.parse_log_line(line)
self.log.info(message)
Comment on lines 201 to 204

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

                for raw_line in logs:
                    line = raw_line.decode('utf-8', errors="backslashreplace")
                    timestamp, message = self.parse_log_line(line)

except BaseHTTPError: # Catches errors like ProtocolError(TimeoutError).
self.log.warning(
Expand Down