Spaces:
Sleeping
Sleeping
Download external_commands.py from Aravindhan11/AI_Code_Terminal: direct link, hf CLI and curl.
- Browser
- Download file 515 Bytes
-
https://huggingface.co/spaces/Aravindhan11/AI_Code_Terminal/resolve/main/external_commands.py
- Command line
-
hf download hf://spaces/Aravindhan11/AI_Code_Terminal/external_commands.py
-
curl -L -o external_commands.py https://huggingface.co/spaces/Aravindhan11/AI_Code_Terminal/resolve/main/external_commands.py
515 Bytes
| # external_commands.py | |
| import subprocess | |
| from colors import * | |
| def run_external_command(command_parts): | |
| """Run external system commands""" | |
| try: | |
| result = subprocess.run(command_parts) | |
| if result.returncode != 0: | |
| print(f"{RED}⚠️ Command exited with code: {result.returncode}{RESET}") | |
| except FileNotFoundError: | |
| print(f"{RED}❌ Command not found: {command_parts[0]}{RESET}") | |
| except KeyboardInterrupt: | |
| print(f"{YELLOW}⏸️ Command interrupted{RESET}") | |