( attached: SidecarConnection, )
| 267 | }; |
| 268 | |
| 269 | const acceptSupervisedConnection = async ( |
| 270 | attached: SidecarConnection, |
| 271 | ): Promise<SidecarConnection | null> => { |
| 272 | if (!shouldReplaceDaemonForDesktop(attached)) return attached; |
| 273 | const settings = getServerSettings(); |
| 274 | return replaceSupervisedDaemonForDesktop(attached, { |
| 275 | install: () => |
| 276 | installSupervisedService({ |
| 277 | port: settings.port, |
| 278 | dataDir: DESKTOP_DATA_DIR, |
| 279 | }), |
| 280 | waitForAttach: () => waitForSupervisedAttach(30_000, { port: settings.port }), |
| 281 | attach: attachToSupervisedDaemon, |
| 282 | onInstallFailure: (error) => { |
| 283 | log.warn("Failed to replace older supervised daemon; re-checking before falling back", error); |
| 284 | }, |
| 285 | }); |
| 286 | }; |
| 287 | |
| 288 | const installSupervisedAndWait = async (reason: string): Promise<SidecarConnection | null> => { |
| 289 | const settings = getServerSettings(); |
no test coverage detected