updated output-capture for JSON parsing

This commit is contained in:
2025-10-25 13:05:12 +02:00
parent 02612c5fa2
commit c12a85ceec

View File

@@ -108,11 +108,14 @@ def convert_audio_track(stream_index, channels, temp_dir, source_file, should_do
# Read stderr and print progress updates. The Tee class now handles '\r' correctly.
stderr_output = ""
for line in iter(process.stderr.readline, ''):
stderr_output += line # Buffer the full output for parsing
# Print the line to stdout, clearing the line and using a carriage return.
# This will be handled by the Tee class.
sys.stdout.write(line.strip() + '\x1B[K\r')
with process.stderr as pipe:
for line in iter(pipe.readline, ''):
stderr_output += line # Buffer the full output for parsing
# Print the line to stdout, clearing the line and using a carriage return.
# This will be handled by the Tee class.
sys.stdout.write(line.strip() + '\x1B[K\r')
# After the loop, read any remaining data (the JSON block)
stderr_output += pipe.read()
process.wait() # Wait for the process to terminate
if process.returncode != 0: