diff --git a/src/huggingface_hub/utils/__init__.py b/src/huggingface_hub/utils/__init__.py index 9b01e40496..76f80ef529 100644 --- a/src/huggingface_hub/utils/__init__.py +++ b/src/huggingface_hub/utils/__init__.py @@ -23,9 +23,25 @@ def run_subprocess(command, folder, check=True) -> subprocess.CompletedProcess: + """ + Method to run subprocesses. Calling this will capture the `stderr` and `stdout`, + please call `subprocess.run` manually in case you would like for them not to + be captured. + + Args: + command (`str`): + The command to execute + folder (`str`): + The folder in which to run the command. + check (`bool`, *optional*, defaults to `True`): + Setting `check` to `True` will raise a `subprocess.CalledProcessError` + when the subprocess has a non-zero exit code. + + Returns: + `subprocess.CompletedProcess`: The completed process. + """ if isinstance(command, str): - logger.error("`run_subprocess` should be called with a list of strings.") - command = command.split() + raise ValueError("`run_subprocess` should be called with a list of strings.") return subprocess.run( command,