(result: { origin: string; reused?: boolean; host?: string })
| 187 | // rides in the opened Web UI URL's `#token=` fragment (M5.5). Falls back to |
| 188 | // the plain origin / no token line when unavailable. |
| 189 | const writeReady = (result: { origin: string; reused?: boolean; host?: string }): void => { |
| 190 | const { origin } = result; |
| 191 | const host = result.host ?? parsed.host; |
| 192 | const token = deps.resolveToken?.(); |
| 193 | let output = ''; |
| 194 | if (result.reused === true) { |
| 195 | // A daemon was already running, so this command's --host/--port/etc. did |
| 196 | // not start a new one. Say so loudly, then print the actual running |
| 197 | // server's URLs (using its real bind host, not the requested one). |
| 198 | output += formatReuseNotice(origin); |
| 199 | } |
| 200 | output += |
| 201 | parsed.logLevel === DEFAULT_FOREGROUND_LOG_LEVEL |
| 202 | ? formatReadyBanner(origin, host, { |
| 203 | token, |
| 204 | networkAddresses: deps.networkAddresses, |
| 205 | }) |
| 206 | : formatReadyLine(origin, token); |
| 207 | deps.stdout.write(output); |
| 208 | if (opts.open === true) { |
| 209 | deps.openUrl(token !== undefined ? buildWebUrl(origin, token) : origin); |
| 210 | } |
| 211 | }; |
| 212 | if (opts.foreground === true) { |
| 213 | const run = deps.startServerForeground ?? startServerForeground; |
| 214 | await run(parsed, { |
no test coverage detected