Merge pull request #2844 from sergiofspedro/fix/windows-port-release

fix: kill orphaned process on Windows before OpenCode restart
This commit is contained in:
Bohdan Triapitsyn
2026-08-28 01:23:04 +03:00
committed by GitHub
3 changed files with 115 additions and 8 deletions
+2 -2
View File
@@ -1162,8 +1162,8 @@ const openCodeLifecycleRuntime = createOpenCodeLifecycleRuntime({
return [...new Set(directories)];
},
// A managed restart can move OpenCode to a NEW port (the old one may stay
// occupied by an orphaned process, e.g. killProcessOnPort is a no-op on
// Windows). Rebind the message-stream upstream readers to the current port
// occupied if killProcessOnPort/waitForPortRelease didn't free it in time,
// on any platform). Rebind the message-stream upstream readers to the current port
// so the UI keeps receiving events instead of staying pinned to the old
// process (#2638). The runtime is created later by the startup pipeline;
// by the time any restart runs, it is assigned.