MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / active

Function active

packages/server/src/service.rs:107–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105}
106
107pub fn active() -> anyhow::Result<Option<ServiceInstallResult>> {
108 if !launch_agent_supported() {
109 return Ok(None);
110 }
111 let domain = launchctl_domain()?;
112 if launchagent_pid(&domain, SERVICE_LABEL).is_none() {
113 return Ok(None);
114 }
115 let Some(arguments) = installed_arguments_for_label(SERVICE_LABEL)? else {
116 return Ok(None);
117 };
118 let plist_path = plist_path()?;
119 let log_dir = log_dir()?;
120 let port = argument_value(&arguments, "--port")
121 .and_then(|value| value.parse::<u16>().ok())
122 .unwrap_or(4310);
123 Ok(Some(ServiceInstallResult {
124 service: SERVICE_LABEL.to_owned(),
125 plist_path,
126 executable_path: installed_executable_path(&arguments),
127 stdout_log: log_dir.join("simdeck.log"),
128 stderr_log: log_dir.join("simdeck.err.log"),
129 port,
130 advertise_host: argument_value(&arguments, "--advertise-host"),
131 access_token: argument_value(&arguments, "--access-token"),
132 pairing_code: argument_value(&arguments, "--pairing-code"),
133 reused: true,
134 }))
135}
136
137fn install(mut options: ServiceOptions) -> anyhow::Result<ServiceInstallResult> {
138 let plist_path = plist_path()?;

Callers 7

command_service_urlFunction · 0.85
stop_project_serviceFunction · 0.85
service_statusFunction · 0.85
run_default_serviceFunction · 0.85
restart_detached_serviceFunction · 0.85
pair_global_serviceFunction · 0.85

Calls 8

launch_agent_supportedFunction · 0.85
launchctl_domainFunction · 0.85
launchagent_pidFunction · 0.85
plist_pathFunction · 0.85
log_dirFunction · 0.85
argument_valueFunction · 0.85

Tested by

no test coverage detected