diff --git a/scripts/threads/commands.py b/scripts/threads/commands.py index 1e19e54..e687e36 100644 --- a/scripts/threads/commands.py +++ b/scripts/threads/commands.py @@ -19,15 +19,23 @@ def clearCondition(command: str) -> bool: return command in ["c", "clear", "cls"] +def clearScreen(): + print(run_command("clear")) + return None + + def systemCommand(command: str) -> str: words = command[1:].split() if words[0] == "": return "Command not found. Write 'h' for help." - print( - run_command( - f'docker exec -it webscraper {" ".join(words)}', + try: + print( + run_command( + f'docker exec -it webscraper {" ".join(words)}', + ) ) - ) + except Exception as e: + print(f"An error occurred: {e}") return None diff --git a/scripts/threads/prompt.py b/scripts/threads/prompt.py index 75a1416..c788b94 100644 --- a/scripts/threads/prompt.py +++ b/scripts/threads/prompt.py @@ -15,7 +15,7 @@ def prompt(): print(help_list()) continue if clearCondition(command): - run_command("clear") + clearScreen() continue if command.startswith("$"): systemCommand(command)