* @brief Terminates a single managed process; returns false when the id is unknown. */
| 213 | * @brief Terminates a single managed process; returns false when the id is unknown. |
| 214 | */ |
| 215 | bool API::ProcessLauncher::kill(int processId) |
| 216 | { |
| 217 | auto* process = m_processes.take(processId); |
| 218 | if (!process) |
| 219 | return false; |
| 220 | |
| 221 | process->terminate(); |
| 222 | if (!process->waitForFinished(kTerminateGraceMs)) |
| 223 | process->kill(); |
| 224 | |
| 225 | process->deleteLater(); |
| 226 | return true; |
| 227 | } |
| 228 | |
| 229 | /** |
| 230 | * @brief Terminates every managed process (terminate, then kill on grace-period timeout). |
no outgoing calls