Finish loading the vscode examples v1; Improve on the infra: Add accessibility tree into the observation; Add activate window function, etc
This commit is contained in:
@@ -1,22 +1,19 @@
|
||||
import os
|
||||
import logging
|
||||
from typing import Dict
|
||||
import requests
|
||||
|
||||
logger = logging.getLogger("desktopenv.getters.general")
|
||||
|
||||
|
||||
def get_string(env, config: Dict[str, str]) -> str:
|
||||
"""
|
||||
Config:
|
||||
string (str)
|
||||
"""
|
||||
def get_vm_command_line(env, config: Dict[str, str]):
|
||||
vm_ip = env.vm_ip
|
||||
port = 5000
|
||||
command = config["command"]
|
||||
|
||||
return config["string"]
|
||||
response = requests.post(f"http://{vm_ip}:{port}/execute", json={"command": command})
|
||||
|
||||
|
||||
def get_command_line(env, config: Dict[str, str]) -> str:
|
||||
"""
|
||||
Config:
|
||||
string (str)
|
||||
"""
|
||||
|
||||
f = os.popen(config["command"])
|
||||
|
||||
return f.read()
|
||||
if response.status_code == 200:
|
||||
return response.json()["output"]
|
||||
else:
|
||||
logger.error("Failed to get vm command line. Status code: %d", response.status_code)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user