@@ -169,23 +169,6 @@ async function strictRuntimePortAvailable(port: number, hostname = "127.0.0.1"):
169169 return true ;
170170}
171171
172- async function waitForStrictRuntimeBind (
173- port : number ,
174- hostname : string ,
175- timeoutMs : number ,
176- sleep : ( ms : number ) => Promise < void > ,
177- ) : Promise < boolean > {
178- const deadline = Date . now ( ) + timeoutMs ;
179- while ( Date . now ( ) < deadline ) {
180- if ( process . platform === "win32" ) {
181- try { dropWindowsTcpRowsForLocalPort ( port ) ; } catch { /* best-effort */ }
182- }
183- if ( await strictRuntimePortAvailable ( port , hostname ) ) return true ;
184- await sleep ( 500 ) ;
185- }
186- return false ;
187- }
188-
189172/**
190173 * Wait until netstat reports no LISTEN owners on `port` AND Node+Bun can bind.
191174 * Dead PIDs still appear as holders while the ghost TCB lives; SetTcpEntry is a
@@ -843,12 +826,10 @@ async function restartAfterUpdate(
843826 }
844827 }
845828 }
846- const spawnStart = io . spawnStart ?? spawnDetachedStart ;
847- // Production path only: injected spawnStart keeps unit tests deterministic (one call).
848- // Published `ocx start --port` may spend up to ~30s reclaiming ghost rows; retry on
849- // missing /healthz, kill the previous detached attempt, and re-wait for a Bun bind.
829+ // Injected spawnStart keeps unit tests deterministic (one call). Production path
830+ // retries on missing /healthz after prepare + ghost-LISTEN clear.
850831 if ( io . spawnStart ) {
851- spawnStart ( job , job . installer , port ) ;
832+ io . spawnStart ( job , job . installer , port ) ;
852833 return ;
853834 }
854835 const sleep = io . sleepMs ?? ( ( ms : number ) => new Promise < void > ( r => setTimeout ( r , ms ) ) ) ;
0 commit comments