|
|
@@ -60,6 +60,22 @@ function Get-EnvPort($key, $default) {
|
|
|
return $default
|
|
|
}
|
|
|
|
|
|
+# Returns $true if the TCP port is accepting connections.
|
|
|
+# Using TCP instead of HTTP so HTTP 4xx/auth errors don't cause false negatives.
|
|
|
+function Test-ServiceUp($svc) {
|
|
|
+ try {
|
|
|
+ $uri = [System.Uri]$svc.Url
|
|
|
+ $port = if ($uri.Port -gt 0) { $uri.Port } else { 80 }
|
|
|
+ $tcp = New-Object System.Net.Sockets.TcpClient
|
|
|
+ $ar = $tcp.BeginConnect($uri.Host, $port, $null, $null)
|
|
|
+ $ok = $ar.AsyncWaitHandle.WaitOne(1500, $false)
|
|
|
+ try { $tcp.Close() } catch {}
|
|
|
+ return $ok
|
|
|
+ } catch {
|
|
|
+ return $false
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
# -- 1. Check / install GUI venv -----------------------------------------------
|
|
|
if (-not $GuiOnly -and -not $SkipInstall) {
|
|
|
Write-Step "Checking GUI environment"
|
|
|
@@ -269,21 +285,6 @@ if (-not $GuiOnly) {
|
|
|
)
|
|
|
|
|
|
$maxWait = 120; $interval = 3; $elapsed = 0
|
|
|
- # Helper: returns $true if the TCP port is accepting connections.
|
|
|
- # Using TCP instead of HTTP so HTTP 4xx / auth errors don't cause false negatives.
|
|
|
- function Test-ServiceUp($svc) {
|
|
|
- try {
|
|
|
- $uri = [System.Uri]$svc.Url
|
|
|
- $port = if ($uri.Port -gt 0) { $uri.Port } else { 80 }
|
|
|
- $tcp = New-Object System.Net.Sockets.TcpClient
|
|
|
- $ar = $tcp.BeginConnect($uri.Host, $port, $null, $null)
|
|
|
- $ok = $ar.AsyncWaitHandle.WaitOne(1500, $false)
|
|
|
- try { $tcp.Close() } catch {}
|
|
|
- return $ok
|
|
|
- } catch {
|
|
|
- return $false
|
|
|
- }
|
|
|
- }
|
|
|
|
|
|
while ($elapsed -lt $maxWait) {
|
|
|
$pending = @()
|