Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LysandreJik committed Apr 18, 2022
1 parent 858f067 commit 3b52996
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/huggingface_hub/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 3b52996

Please sign in to comment.