Skip to content

Commit 789d59f

Browse files
ajwan8998claude
andcommitted
fix(ports): specify IPv4 loopback host in ensurePortAvailable
ensurePortAvailable uses net.listen({ port }) without specifying host. On dual-stack machines, this binds to the IPv6 wildcard '::', so an IPv4-only occupant of 127.0.0.1 is not detected and the pre-flight erroneously reports the port as free. Add host: '127.0.0.1'. Closes: #94379 Co-Authored-By: Claude <[email protected]>
1 parent 2f8f936 commit 789d59f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/infra/ports.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function describePortOwner(port: number): Promise<string | undefine
3939
export async function ensurePortAvailable(port: number): Promise<void> {
4040
// Detect EADDRINUSE early with a friendly message.
4141
try {
42-
await tryListenOnPort({ port });
42+
await tryListenOnPort({ port, host: "127.0.0.1" });
4343
} catch (err) {
4444
if (isErrno(err) && err.code === "EADDRINUSE") {
4545
throw new PortInUseError(port);

0 commit comments

Comments
 (0)