qwen-7b-chat / run_cmd.py
ffreemt
Update Waking-up-takes-about-9min-Sleep-after-15min-of-inactivity
1d516ba
raw
history blame contribute delete
344 Bytes
"""Run a command."""
import subprocess as sp
import rich
from loguru import logger
def run_cmd(cmd):
"""Execute cmd."""
logger.info(f"{cmd=}")
ret = sp.run(cmd, capture_output=1, check=0, shell=1, encoding="utf8")
if ret.stdout:
rich.print(ret.stdout)
if ret.stderr:
rich.print("[red bold]" + ret.stdout)