diff --git a/src/download/functions.py b/src/download/functions.py index 587b1c9..6ce7a37 100644 --- a/src/download/functions.py +++ b/src/download/functions.py @@ -60,7 +60,12 @@ def clean_cache(directory: Path): shutil.rmtree(directory) -def run(command: str | Sequence[str], verbose: bool, cwd: Path | None = None) -> None: +def run( + command: str | Sequence[str], + verbose: bool, + cwd: Path | None = None, + check: bool = False, +) -> None: """Run command in a subprocess""" # pylint: disable=subprocess-run-check # This toggle allows for a really wasy debug when using -v @@ -77,7 +82,9 @@ def run(command: str | Sequence[str], verbose: bool, cwd: Path | None = None) -> else: args = list(command) - subprocess.run(args, check=False, cwd=cwd) + result = subprocess.run(args, check=check, cwd=cwd) + if not check and result.returncode != 0: + LOG.warning("Command failed (%s): %s", result.returncode, args) def list_lines(i: int, line: str) -> str: