updated output-capture for JSON parsing
This commit is contained in:
@@ -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.
|
# Read stderr and print progress updates. The Tee class now handles '\r' correctly.
|
||||||
stderr_output = ""
|
stderr_output = ""
|
||||||
for line in iter(process.stderr.readline, ''):
|
with process.stderr as pipe:
|
||||||
|
for line in iter(pipe.readline, ''):
|
||||||
stderr_output += line # Buffer the full output for parsing
|
stderr_output += line # Buffer the full output for parsing
|
||||||
# Print the line to stdout, clearing the line and using a carriage return.
|
# Print the line to stdout, clearing the line and using a carriage return.
|
||||||
# This will be handled by the Tee class.
|
# This will be handled by the Tee class.
|
||||||
sys.stdout.write(line.strip() + '\x1B[K\r')
|
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
|
process.wait() # Wait for the process to terminate
|
||||||
if process.returncode != 0:
|
if process.returncode != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user