Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,14 @@ def run_shell_command(command: list[str]):
如果遇到错误则抛出异常
"""
logging.info(f"运行命令: {command}")
r = subprocess.run(command, check=True, capture_output=True)
logging.debug(f"命令输出: \n{r.stdout.decode()}")
try:
r = subprocess.run(command, check=True, capture_output=True)
logging.debug(f"命令输出: \n{r.stdout.decode()}")
except subprocess.CalledProcessError as e:
logging.error("命令运行失败")
logging.error(f"命令输出: \n{e.stdout.decode()}")
logging.error(f"命令错误: \n{e.stderr.decode()}")
raise
return r


Expand Down