Don't try to read stderr when exception is thrown

This commit is contained in:
George Lacey 2024-05-10 18:09:02 +01:00
parent 6f5bfef1ed
commit 6eefe16c4b

View File

@ -45,10 +45,10 @@ def transcode_worker(in_track, out_track, encoder):
additional_args = ('--bitrate', '128', '--music')
subprocess_args = (str(encoder),) + additional_args + (in_track, out_track)
try:
result = subprocess.run(subprocess_args, capture_output=True, text=True, check=True)
return f"Transcoded '{in_track}' successfully"
subprocess.run(subprocess_args, capture_output=True, text=True, check=True)
return f"Transcoded '{in_track}' successfully."
except CalledProcessError:
return f"ERROR: Transcoding of '{in_track}' failed with errors:\n{result.stderr}"
return f"ERROR: Transcoding of '{in_track}' failed."
def main(input_dir: Path, output_dir: Path, encoder: Path):