MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / refresh_installed_service

Function refresh_installed_service

src/daemon/service.rs:281–298  ·  view source on GitHub ↗
(spec: &DaemonServiceSpec)

Source from the content-addressed store, hash-verified

279}
280
281pub fn refresh_installed_service(spec: &DaemonServiceSpec) -> Result<Option<PathBuf>> {
282 let service_path = service_unit_path()?;
283 if !service_path.exists() {
284 return Ok(None);
285 }
286 let unit = read_service_unit(&service_path)?;
287 let mut refreshed_spec = spec.clone();
288 if let Some(socket_path) = socket_path_from_unit_text(&unit) {
289 refreshed_spec.socket_path = socket_path;
290 }
291 if matches!(ServiceRunner::current(), Ok(ServiceRunner::Launchd)) {
292 // The installed plist is the source of truth for the daemon's data
293 // directory; the refreshing shell may not have the override set.
294 refreshed_spec.data_dir_override =
295 launchd_plist_env_value(&unit, crate::config::USER_DATA_DIR_ENV).map(PathBuf::from);
296 }
297 refresh_service(&refreshed_spec).map(Some)
298}
299
300fn write_service_unit(spec: &DaemonServiceSpec) -> Result<PathBuf> {
301 let service_path = service_unit_path()?;

Calls 6

service_unit_pathFunction · 0.85
read_service_unitFunction · 0.85
launchd_plist_env_valueFunction · 0.85
refresh_serviceFunction · 0.85
existsMethod · 0.80