fix(cli): correct misleading comment on isPortAvailable IPv6 coverage
The comment claimed connect-based detection works for IPv6 listeners, but the probe only connects to 127.0.0.1 (IPv4). Updated the comment to accurately document this limitation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
dfcc0841ec
commit
42442e007e
|
|
@ -17,13 +17,13 @@ const require = createRequire(import.meta.url);
|
|||
const DEFAULT_TERMINAL_PORT = 14800;
|
||||
|
||||
/**
|
||||
* Check if a TCP port is available by attempting to connect to it.
|
||||
* Check if a TCP port is available by attempting to connect to it on IPv4.
|
||||
* A successful connect means something is already listening (port in use).
|
||||
* ECONNREFUSED means nothing is listening (port free).
|
||||
*
|
||||
* Connect-based detection is more reliable than bind-based because it works
|
||||
* regardless of whether the occupying process is bound to 127.0.0.1, ::1,
|
||||
* 0.0.0.0, or :: (IPv6 wildcard).
|
||||
* Note: Only probes 127.0.0.1 (IPv4). Processes listening exclusively on
|
||||
* IPv6 (::1 with IPV6_V6ONLY=1) will not be detected — this is acceptable
|
||||
* since the dashboard binds to 0.0.0.0 by default.
|
||||
*/
|
||||
export function isPortAvailable(port: number): Promise<boolean> {
|
||||
return new Promise((resolve) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue