MCPcopy Create free account
hub / github.com/Windscribe/Desktop-App / executeTaskKill

Function executeTaskKill

src/helper/linux/process_command.cpp:148–190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148std::string executeTaskKill(const std::string &pars)
149{
150 CmdKillTarget target;
151 deserializePars(pars, target);
152 bool success = false;
153
154 if (target == kTargetApp) {
155 spdlog::info("Killing " WS_PRODUCT_NAME " processes");
156 Utils::executeCommand("pkill", {WS_APP_EXECUTABLE_NAME});
157#ifdef WS_IS_WINDSCRIBE
158 Utils::executeCommand("pkill", {WS_APP_IDENTIFIER "Engine"}); // For older 1.x clients
159#endif
160 success = true;
161 } else if (target == kTargetOpenVpn) {
162 spdlog::info("Killing OpenVPN processes");
163 const std::vector<std::string> exes = Utils::getOpenVpnExeNames();
164 for (const auto &exe : exes) {
165 Utils::executeCommand("pkill", {"-f", exe.c_str()});
166 }
167 OVPN::setUseDco(true);
168 success = true;
169 } else if (target == kTargetStunnel) {
170 spdlog::info("Killing Stunnel processes");
171 Utils::executeCommand("pkill", {"-f", WS_PRODUCT_NAME_LOWER "wstunnel"});
172 success = true;
173 } else if (target == kTargetWStunnel) {
174 spdlog::info("Killing WStunnel processes");
175 Utils::executeCommand("pkill", {"-f", WS_PRODUCT_NAME_LOWER "wstunnel"});
176 success = true;
177 } else if (target == kTargetWireGuard) {
178 spdlog::info("Killing WireGuard processes");
179 Utils::executeCommand("pkill", {"-f", WS_PRODUCT_NAME_LOWER "wireguard"});
180 success = true;
181 } else if (target == kTargetCtrld) {
182 spdlog::info("Killing ctrld processes");
183 Utils::executeCommand("pkill", {"-f", WS_PRODUCT_NAME_LOWER "ctrld"});
184 success = true;
185 } else {
186 spdlog::error("Did not kill processes for type {}", (int)target);
187 success = false;
188 }
189 return serializeResult(success);
190}
191
192std::string startWireGuard(const std::string &pars)
193{

Callers

nothing calls this directly

Calls 5

deserializeParsFunction · 0.85
setUseDcoFunction · 0.85
serializeResultFunction · 0.85
executeCommandFunction · 0.70
getOpenVpnExeNamesFunction · 0.70

Tested by

no test coverage detected