From 6e78610db84f7523bb8568fa25c629ec5233fb22 Mon Sep 17 00:00:00 2001 From: iret77 <63622643+iret77@users.noreply.github.com> Date: Sat, 6 Jun 2026 01:24:04 +0200 Subject: [PATCH] fix(windows): drop hardcoded `lsof` from backend http-bind-failure text MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The HTTP-bind-failure path in `lib.rs::spawn_http_server` writes a plaintext diagnostic into `status.http_error` that the frontend renders verbatim above the OS-specific `settings.http_error.hint.{os}` line. The previous text included `lsof -i :{port}` — a macOS/Linux-only command. On Windows the user would see the Mac `lsof` suggestion *above* the correct PowerShell suggestion (Get-NetTCPConnection / OwningProcess), which is confusing and contradicts the platform-aware i18n split established in PR #128. Fix: drop the diagnostic-command sentence from the backend text. The plaintext now just states "port is held by another process" + the underlying error; the OS-correct command stays where it already lives, in the frontend hint. Caught while auditing the v0.4.40 → v0.4.46 delta for Windows-only regressions before handing the next NSIS build to the external tester. Verification (macOS arm64): cargo check / clippy `-D warnings` / test --lib (98/98), all clean. Co-Authored-By: Claude Opus 4.7 (1M context) --- companion/src-tauri/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/companion/src-tauri/src/lib.rs b/companion/src-tauri/src/lib.rs index 768e8db..add0e72 100644 --- a/companion/src-tauri/src/lib.rs +++ b/companion/src-tauri/src/lib.rs @@ -1376,10 +1376,16 @@ pub fn run() { "[aiui] http-bind-error on :{port_for_error}: {e} — degraded mode, surfacing settings banner" )); if let Ok(mut slot) = http_error_for_serve.lock() { + // The OS-specific diagnostic command (`lsof`, + // `Get-NetTCPConnection`, `ss`) lives in the + // frontend's `settings.http_error.hint.{os}` + // i18n string, rendered just below this text. + // Keep the backend message platform-neutral so + // Windows users don't see a confusing `lsof` + // suggestion above the correct PowerShell one. *slot = Some(format!( "Konnte localhost:{port_for_error} nicht öffnen — \ - Port von einem anderen Prozess belegt. Schließe den \ - Prozess (lsof -i :{port_for_error}) und starte aiui neu. {e}" + Port von einem anderen Prozess belegt. {e}" )); } // Surface the Settings window so the http_error banner