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