mirror of
https://github.com/zed-industries/zed.git
synced 2026-11-23 00:50:35 +01:00
7dc397b61b
When connecting to a Windows host over SSH, the proxy fails to start the daemon and the user sees "failed to spawn server." **Root cause** `spawn_server_windows` invokes the daemon via `shell_execute_from_explorer`, which goes through COM `ShellWindows` / `IShellDispatch2::ShellExecute`. That path requires both: - `explorer.exe` running in the caller's session, and - an interactive desktop / window station. Neither is available when `zed-remote-server proxy` is launched by sshd: sshd-spawned processes live in a non-interactive window station with no Explorer. The COM call fails, the `run` daemon never starts, the proxy's 10s socket-existence poll times out, and the connection fails. A commenter on #48966 reports the connection succeeds after first logging in via RDP, which is consistent with this diagnosis: RDP login populates the session with `explorer.exe` and an interactive window station. **Fix** Replace the COM path with a direct `Command::spawn`, matching the non-Windows branch. Use `DETACHED_PROCESS | CREATE_NEW_PROCESS_GROUP` creation flags so the daemon has no inherited console and is not killed by Ctrl+C/Break broadcast to the parent's group when the proxy exits. Bypass `util::new_command` because it presets `CREATE_NO_WINDOW`, which Win32 disallows combining with `DETACHED_PROCESS`. Drop one layer to `smol::process::Command` directly to keep the disallowed-methods lint happy. Also drop the now-unused `shell_execute_from_explorer` module and the `windows` crate dependency it pulled in. No automated test is included: exercising this path requires a headless OpenSSH-Server-on-Windows host with a non-interactive window station, which CI doesn't currently provide. Verified manually that macOS client -> Windows host over SSH establishes the connection successfully where it previously timed out. Closes #48966 Self-Review Checklist: - [x] I've reviewed my own diff for quality, security, and reliability - [x] Unsafe blocks (if any) have justifying comments - [x] The content is consistent with the [UI/UX checklist](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist) - [ ] Tests cover the new/changed behavior - [x] Performance impact has been considered and is acceptable Release Notes: - Fixed remote server failing to start when connecting to a Windows host over SSH --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Co-authored-by: John Tur <john-tur@outlook.com>