MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / execute_command

Function execute_command

keepercommander/service/api/command.py:128–141  ·  view source on GitHub ↗

Submit a command for execution and return request ID immediately.

(**kwargs)

Source from the content-addressed store, hash-verified

126 @bp.route("/executecommand-async", methods=["POST"])
127 @unified_api_decorator()
128 def execute_command(**kwargs) -> Tuple[Response, int]:
129 """Submit a command for execution and return request ID immediately."""
130 temp_files = []
131 try:
132 processed_command, temp_files, request_error = _prepare_command_request()
133 if request_error:
134 return request_error
135
136 response_data, _ = _submit_queue_request(processed_command, temp_files, wait_for_completion=False)
137 return response_data
138 except Exception as e:
139 logger.error(f"Error submitting request: {e}")
140 RequestValidator.cleanup_temp_files(temp_files)
141 return jsonify({"status": "error", "error": f"{str(e)}"}), 500
142
143 @bp.route("/status/<request_id>", methods=["GET"])
144 @unified_api_decorator()

Callers

nothing calls this directly

Calls 4

_prepare_command_requestFunction · 0.85
_submit_queue_requestFunction · 0.85
cleanup_temp_filesMethod · 0.80
errorMethod · 0.45

Tested by

no test coverage detected