| 97 | }); |
| 98 | |
| 99 | const stopDaemon = async (child: ChildProcess | undefined): Promise<void> => { |
| 100 | if (!child || child.exitCode !== null || child.signalCode !== null) return; |
| 101 | await new Promise<void>((resolve) => { |
| 102 | const timeout = setTimeout(() => { |
| 103 | child.kill("SIGKILL"); |
| 104 | resolve(); |
| 105 | }, 5_000); |
| 106 | child.once("exit", () => { |
| 107 | clearTimeout(timeout); |
| 108 | resolve(); |
| 109 | }); |
| 110 | child.kill("SIGTERM"); |
| 111 | }); |
| 112 | }; |
| 113 | |
| 114 | scenario( |
| 115 | "Desktop · attaches to a CLI daemon that already owns the data dir instead of wedging", |