INNER CODE UNIT · Python
command_endpoint
iamgreggarcia/codesherpa · localserver/main.py:228
async def command_endpoint(command_request: CommandExecutionRequest):
"""
Run commands.
Args:
command_request (CommandExecutionRequest): The request object containing the command to execute.
Returns:
CommandExecutionResponse: The result of the command execution.
"""
logger.info(f"Executing command with request: {command_request}")
try:
command_result = await execute_command(command_request.command)
logger.info(f"Command execution result: {command_result}")
return {"result": command_result}
except Exception as e:
logger.error(f"Error in command execution: {e}")
return {"error": str(e)}