Commands that (re)start the launchd agent. Booting the service out first (tolerating "not loaded") makes the sequence idempotent, and enabling before bootstrap clears any persisted disabled state so the bootstrap cannot be rejected.
(
domain: &str,
target: &str,
service_path: &Path,
)
| 689 | /// before bootstrap clears any persisted disabled state so the bootstrap |
| 690 | /// cannot be rejected. |
| 691 | fn launchd_start_command_plan( |
| 692 | domain: &str, |
| 693 | target: &str, |
| 694 | service_path: &Path, |
| 695 | ) -> Vec<LaunchdCommand> { |
| 696 | vec![ |
| 697 | LaunchdCommand::new( |
| 698 | &["bootout", target], |
| 699 | LaunchctlFailureMode::TolerateNotLoaded, |
| 700 | ), |
| 701 | LaunchdCommand::new(&["enable", target], LaunchctlFailureMode::Fail), |
| 702 | LaunchdCommand::new( |
| 703 | &["bootstrap", domain, &service_path.display().to_string()], |
| 704 | LaunchctlFailureMode::Fail, |
| 705 | ), |
| 706 | LaunchdCommand::new(&["kickstart", "-k", target], LaunchctlFailureMode::Fail), |
| 707 | ] |
| 708 | } |
| 709 | |
| 710 | fn launchd_uninstall_command_plan(target: &str) -> Vec<LaunchdCommand> { |
| 711 | vec![ |