(domain: &str)
| 478 | } |
| 479 | |
| 480 | fn unload_existing_services(domain: &str) -> anyhow::Result<Vec<u32>> { |
| 481 | let mut killed = Vec::new(); |
| 482 | for label in service_labels() { |
| 483 | let plist_path = plist_path_for_label(label)?; |
| 484 | let old_pid = launchagent_pid(domain, label); |
| 485 | let service_target = format!("{domain}/{label}"); |
| 486 | let _ = Command::new("launchctl") |
| 487 | .args(["bootout", &service_target]) |
| 488 | .output(); |
| 489 | if plist_path.exists() { |
| 490 | let _ = Command::new("launchctl") |
| 491 | .args(["bootout", domain, plist_path.to_string_lossy().as_ref()]) |
| 492 | .output(); |
| 493 | } |
| 494 | if let Some(pid) = old_pid { |
| 495 | terminate_process_group(pid, SERVICE_SHUTDOWN_GRACE); |
| 496 | killed.push(pid); |
| 497 | } |
| 498 | } |
| 499 | Ok(killed) |
| 500 | } |
| 501 | |
| 502 | fn launchagent_pid(domain: &str, label: &str) -> Option<u32> { |
| 503 | let target = format!("{domain}/{label}"); |
no test coverage detected