( attached: SidecarConnection, )
| 228 | }; |
| 229 | |
| 230 | const acceptSupervisedConnection = async ( |
| 231 | attached: SidecarConnection, |
| 232 | ): Promise<SidecarConnection | null> => { |
| 233 | if (!shouldReplaceDaemonForDesktop(attached)) return attached; |
| 234 | const settings = getServerSettings(); |
| 235 | return replaceSupervisedDaemonForDesktop(attached, { |
| 236 | install: () => |
| 237 | installSupervisedService({ |
| 238 | port: settings.port, |
| 239 | dataDir: DESKTOP_DATA_DIR, |
| 240 | }), |
| 241 | waitForAttach: () => waitForSupervisedAttach(30_000, { port: settings.port }), |
| 242 | attach: attachToSupervisedDaemon, |
| 243 | onInstallFailure: (error) => { |
| 244 | log.warn("Failed to replace older supervised daemon; re-checking before falling back", error); |
| 245 | }, |
| 246 | }); |
| 247 | }; |
| 248 | |
| 249 | const installSupervisedAndWait = async (reason: string): Promise<SidecarConnection | null> => { |
| 250 | const settings = getServerSettings(); |
no test coverage detected