MCPcopy Create free account
hub / github.com/RGAA-Software/GoDesk / HandleKillProcess

Method HandleKillProcess

src/render_panel/network/http_handler.cpp:143–159  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141 }
142
143 void HttpHandler::HandleKillProcess(http::web_request &req, http::web_response &rep) {
144 int pid = 0;
145 try {
146 auto obj = nlohmann::json::parse(req.body());
147 auto pid_str = obj["pid"].get<std::string>();
148 pid = std::atoi(pid_str.c_str());
149 } catch (std::exception& e) {
150 LOGE("parse json failed, body:{}", req.body());
151 auto nr = NetResp::Make(kParamError, std::format("param error: {}", req.body()), "");
152 rep.fill_json(nr.Dump());
153 return;
154 }
155
156 ProcessUtil::KillProcess(pid);
157 auto nr = NetResp::Make(kNetOk, "OK", "");
158 rep.fill_json(nr.Dump());
159 }
160
161 void HttpHandler::HandleResourcesFile(http::web_request &req, http::web_response &rep) {
162 std::string_view target = req.target();

Callers 1

StartMethod · 0.80

Calls 1

DumpMethod · 0.45

Tested by

no test coverage detected