File size: 344 Bytes
fae4857
 
 
 
 
 
 
 
 
 
1d516ba
fae4857
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
"""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)