update information

This commit is contained in:
Grey_D
2023-03-07 14:42:20 -06:00
parent bef7ba975e
commit a4e5361d76
10 changed files with 77 additions and 36 deletions

0
task_handle/__init__.py Normal file
View File

View File

@@ -0,0 +1,27 @@
import os
def execute_cmd(cmd:str) -> str:
"""
Execute the command in the mac terminal.
Parameters
----------
cmd: str
The command to be executed.
Returns
----------
output: str
The output of the command.
"""
# execute the command in the mac terminal.
# Alert!! The execution should be really careful, because it can be dangerous.
# It is recommended to use this in a sandbox environment.
try:
output = os.popen(cmd).read()
except Exception as e:
print("Error when executing command %s in terminal:" % cmd )
print("Error is:", e)
return False
return output