Commit d3ad02e
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 eb4e016 commit d3ad02e
2 files changed
Lines changed: 33 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
425 | 425 | | |
426 | 426 | | |
427 | 427 | | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 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