Commit 99994a9
committed
feat(gui): skip transient daemon child when daemon already running
The GUI startup path always spawned a `lan-mouse daemon` child
process and immediately killed it on exit. If a daemon was already
running — e.g. because the user had launched `lan-mouse daemon`
standalone — the spawned child died early with `AlreadyRunning`,
producing a noisy "service already running!" line and a brief
phantom process in the tree.
Probe the IPC socket via `lan-mouse-ipc::is_service_running` before
spawning. If something's already listening, attach to it and skip
the child entirely; the existing SIGINT/wait/SIGKILL teardown is
gated on a `Some(child)` so an externally managed daemon outlives
the GUI as expected.
The probe is a one-shot connect; a stale socket file with no
listener returns false and the daemon's own bind path cleans the
file up.
Inspired by the approach in feschber#407, layered on top of feschber#436's
dedicated GuiLock so the singleton guarantee remains atomic and
cross-platform — this just removes the transient-child noise on
the headless-daemon-then-GUI path.1 parent 8bfcf5b commit 99994a9
2 files changed
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
111 | 122 | | |
112 | 123 | | |
113 | 124 | | |
114 | 125 | | |
115 | 126 | | |
116 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
117 | 130 | | |
118 | | - | |
| 131 | + | |
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| |||
141 | 154 | | |
142 | 155 | | |
143 | 156 | | |
144 | | - | |
| 157 | + | |
145 | 158 | | |
146 | 159 | | |
147 | 160 | | |
| |||
0 commit comments