1
0
mirror of https://github.com/Mailu/Mailu.git synced 2025-08-10 22:31:47 +02:00

Untested code that may fix the following:

Exception in thread Thread-2 (forward_text_lines):
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()  File "/usr/lib/python3.12/threading.py", line 1010, in run
    self._target(*self._args, **self._kwargs)
  File "/app/venv/lib/python3.12/site-packages/socrate/system.py", line 155, in forward_text_lines
    current_line = src.readline()
                   ^^^^^^^^^^^^^^
  File "<frozen codecs>", line 322, in decode
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xa8 in position 166: invalid start byte

This was reported in #3398

(cherry picked from commit 61812ac32a)
This commit is contained in:
Florent Daigniere
2024-09-05 22:57:35 +02:00
committed by Mergify
parent 45c39d9416
commit 0e9721b7f9

View File

@@ -158,7 +158,7 @@ def forward_text_lines(src, dst):
# runs a process and passes its standard/error output to the standard/error output of the current python script
def run_process_and_forward_output(cmd):
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
process = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, encoding='utf-8')
stdout_thread = threading.Thread(target=forward_text_lines, args=(process.stdout, sys.stdout))
stdout_thread.daemon = True