Download run_cmd.py from Voided0ne/DeCoder: direct link, hf CLI and curl.
- Browser
- Download file 344 Bytes
-
https://huggingface.co/spaces/Voided0ne/DeCoder/resolve/main/run_cmd.py
- Command line
-
hf download hf://spaces/Voided0ne/DeCoder/run_cmd.py
-
curl -L -o run_cmd.py https://huggingface.co/spaces/Voided0ne/DeCoder/resolve/main/run_cmd.py
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) | |