From 898c14763a579ea790b7e8f343475fb26fe0b28e Mon Sep 17 00:00:00 2001 From: Rhys Sullivan Date: Tue, 18 Aug 2026 10:45:57 -0700 Subject: [PATCH] Recognize vite strictPort exits as port collisions in claimAndBoot --- e2e/src/ports.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/e2e/src/ports.ts b/e2e/src/ports.ts index 811f7f4fc..5d227abf5 100644 --- a/e2e/src/ports.ts +++ b/e2e/src/ports.ts @@ -234,8 +234,14 @@ export const isAddrInUse = (error: unknown): boolean => { for (let cursor: unknown = error; cursor instanceof Error; cursor = cursor.cause) { if ((cursor as NodeJS.ErrnoException).code === "EADDRINUSE") return true; // The emulate/vite boot glue wraps the OS error in a plain Error whose - // message carries the code, so match the text too. - if (/EADDRINUSE/.test(cursor.message)) return true; + // message carries the code, so match the text too. Vite's --strictPort + // exit never says EADDRINUSE at all — the CLI catches the bind failure + // and dies with "Port N is already in use", which reaches us only as + // BootProcessExitError's log tail — so match that phrasing as well, or + // the claimAndBoot re-claim retry never engages for the most common + // collision (a Linux ephemeral outbound socket grabbing the claimed + // port between probe release and vite's bind). + if (/EADDRINUSE|is already in use/.test(cursor.message)) return true; } return false; };