Skip to content

Commit d18f9fa

Browse files
committed
win bug fixes
1 parent da3d356 commit d18f9fa

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

win/env-prequisite-checks.ps1

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function Set-ProxyInEnv {
3333
[string]$AccessKey
3434
)
3535

36-
Log-Section "🌐 Network & Proxy Validation" $GLOBAL_LOG
36+
Log-Section "🌐 Network & Proxy Validation" $NOW_RUN_LOG_FILE
3737

3838
$proxy = $env:http_proxy
3939
if ([string]::IsNullOrWhiteSpace($proxy)) { $proxy = $env:HTTP_PROXY }
@@ -44,14 +44,14 @@ function Set-ProxyInEnv {
4444
$env:PROXY_PORT = ""
4545

4646
if ([string]::IsNullOrWhiteSpace($proxy)) {
47-
Log-Line "No proxy found in environment. Using direct connection." $GLOBAL_LOG
47+
Log-Line "No proxy found in environment. Using direct connection." $NOW_RUN_LOG_FILE
4848
return
4949
}
5050

51-
Log-Line "Proxy detected: $proxy" $GLOBAL_LOG
51+
Log-Line "Proxy detected: $proxy" $NOW_RUN_LOG_FILE
5252
$proxyInfo = Parse-ProxyUrl -ProxyUrl $proxy
5353
if (-not $proxyInfo) {
54-
Log-Line "❌ Failed to parse proxy URL: $proxy" $GLOBAL_LOG
54+
Log-Line "❌ Failed to parse proxy URL: $proxy" $NOW_RUN_LOG_FILE
5555
return
5656
}
5757

@@ -72,73 +72,73 @@ function Set-ProxyInEnv {
7272

7373
$null = $webClient.DownloadString($PROXY_TEST_URL)
7474

75-
Log-Line "✅ Reachable via proxy. HTTP 200" $GLOBAL_LOG
76-
Log-Line "Exporting PROXY_HOST=$($proxyInfo.Host)" $GLOBAL_LOG
77-
Log-Line "Exporting PROXY_PORT=$($proxyInfo.Port)" $GLOBAL_LOG
75+
Log-Line "✅ Reachable via proxy. HTTP 200" $NOW_RUN_LOG_FILE
76+
Log-Line "Exporting PROXY_HOST=$($proxyInfo.Host)" $NOW_RUN_LOG_FILE
77+
Log-Line "Exporting PROXY_PORT=$($proxyInfo.Port)" $NOW_RUN_LOG_FILE
7878
$env:PROXY_HOST = $proxyInfo.Host
7979
$env:PROXY_PORT = $proxyInfo.Port
8080
} catch {
8181
$statusMsg = $_.Exception.Message
82-
Log-Line "❌ Not reachable via proxy. Error: $statusMsg" $GLOBAL_LOG
82+
Log-Line "❌ Not reachable via proxy. Error: $statusMsg" $NOW_RUN_LOG_FILE
8383
$env:PROXY_HOST = ""
8484
$env:PROXY_PORT = ""
8585
}
8686
}
8787

8888
function Validate-Tech-Stack {
89-
Log-Line "ℹ️ Checking prerequisites for $script:TECH_STACK" $GLOBAL_LOG
89+
Log-Line "ℹ️ Checking prerequisites for $script:TECH_STACK" $NOW_RUN_LOG_FILE
9090
switch ($script:TECH_STACK) {
9191
"Java" {
9292
if (-not (Get-Command java -ErrorAction SilentlyContinue)) {
93-
Log-Line "❌ Java command not found in PATH." $GLOBAL_LOG
93+
Log-Line "❌ Java command not found in PATH." $NOW_RUN_LOG_FILE
9494
throw "Java not found"
9595
}
9696
$verInfo = & cmd /c 'java -version 2>&1'
9797
if (-not $verInfo) {
98-
Log-Line "❌ Java exists but failed to run." $GLOBAL_LOG
98+
Log-Line "❌ Java exists but failed to run." $NOW_RUN_LOG_FILE
9999
throw "Java invocation failed"
100100
}
101-
Log-Line "✅ Java is installed. Version details:" $GLOBAL_LOG
102-
($verInfo -split "`r?`n") | ForEach-Object { if ($_ -ne "") { Log-Line " $_" $GLOBAL_LOG } }
101+
Log-Line "✅ Java is installed. Version details:" $NOW_RUN_LOG_FILE
102+
($verInfo -split "`r?`n") | ForEach-Object { if ($_ -ne "") { Log-Line " $_" $NOW_RUN_LOG_FILE } }
103103
}
104104
"Python" {
105105
try {
106106
Set-PythonCmd
107107
$code = Invoke-Py -Arguments @("--version") -LogFile $null -WorkingDirectory (Get-Location).Path
108108
if ($code -eq 0) {
109-
Log-Line ("✅ Python3 is installed: {0}" -f ( ($PY_CMD -join ' ') )) $GLOBAL_LOG
109+
Log-Line ("✅ Python3 is installed: {0}" -f ( ($PY_CMD -join ' ') )) $NOW_RUN_LOG_FILE
110110
} else {
111111
throw "Python present but failed to execute"
112112
}
113113
} catch {
114-
Log-Line "❌ Python3 exists but failed to run." $GLOBAL_LOG
114+
Log-Line "❌ Python3 exists but failed to run." $NOW_RUN_LOG_FILE
115115
throw
116116
}
117117
}
118118
"NodeJS" {
119119
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
120-
Log-Line "❌ Node.js command not found in PATH." $GLOBAL_LOG
120+
Log-Line "❌ Node.js command not found in PATH." $NOW_RUN_LOG_FILE
121121
throw "Node not found"
122122
}
123123
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
124-
Log-Line "❌ npm command not found in PATH." $GLOBAL_LOG
124+
Log-Line "❌ npm command not found in PATH." $NOW_RUN_LOG_FILE
125125
throw "npm not found"
126126
}
127127
$nodeVer = & node -v 2>&1
128128
if (-not $nodeVer) {
129-
Log-Line "❌ Node.js exists but failed to run." $GLOBAL_LOG
129+
Log-Line "❌ Node.js exists but failed to run." $NOW_RUN_LOG_FILE
130130
throw "Node.js invocation failed"
131131
}
132132
$npmVer = & npm -v 2>&1
133133
if (-not $npmVer) {
134-
Log-Line "❌ npm exists but failed to run." $GLOBAL_LOG
134+
Log-Line "❌ npm exists but failed to run." $NOW_RUN_LOG_FILE
135135
throw "npm invocation failed"
136136
}
137-
Log-Line "✅ Node.js is installed: $nodeVer" $GLOBAL_LOG
138-
Log-Line "✅ npm is installed: $npmVer" $GLOBAL_LOG
137+
Log-Line "✅ Node.js is installed: $nodeVer" $NOW_RUN_LOG_FILE
138+
Log-Line "✅ npm is installed: $npmVer" $NOW_RUN_LOG_FILE
139139
}
140140
default {
141-
Log-Line "❌ Unknown TECH_STACK: $script:TECH_STACK" $GLOBAL_LOG
141+
Log-Line "❌ Unknown TECH_STACK: $script:TECH_STACK" $NOW_RUN_LOG_FILE
142142
throw "Unknown tech stack"
143143
}
144144
}

0 commit comments

Comments
 (0)