diff --git a/ffmpeg_normalize/_cmd_utils.py b/ffmpeg_normalize/_cmd_utils.py index c48dcd6..e568328 100644 --- a/ffmpeg_normalize/_cmd_utils.py +++ b/ffmpeg_normalize/_cmd_utils.py @@ -3,6 +3,7 @@ import logging import os import re +import shlex import subprocess from platform import system from shutil import which @@ -75,7 +76,7 @@ def run_ffmpeg_command(self, cmd: list[str]) -> Iterator[float]: float: Progress percentage """ # wrapper for 'ffmpeg-progress-yield' - _logger.debug(f"Running command: {cmd}") + _logger.debug(f"Running command: {shlex.join(cmd)}") ff = FfmpegProgress(cmd, dry_run=self.dry) yield from ff.run_command_with_progress() @@ -96,7 +97,7 @@ def run_command(self, cmd: list[str]) -> CommandRunner: Raises: RuntimeError: If command returns non-zero exit code """ - _logger.debug(f"Running command: {cmd}") + _logger.debug(f"Running command: {shlex.join(cmd)}") if self.dry: _logger.debug("Dry mode specified, not actually running command") @@ -116,7 +117,7 @@ def run_command(self, cmd: list[str]) -> CommandRunner: stderr = stderr_bytes.decode("utf8", errors="replace") if p.returncode != 0: - raise RuntimeError(f"Error running command {cmd}: {stderr}") + raise RuntimeError(f"Error running command {shlex.join(cmd)}: {stderr}") self.output = stdout + stderr return self