Treasury & Bank Transfer Management System — سامانه مدیریت خزانهداری و حوالههای بانکی
Isolate Windows installed EXE startup failure by independently probing bundled Next standalone via Node 22 before Electron; no leaked logs
davoodmehraban89 committed
Oct 26, 2026 at 07:55 UTC
62903a0590cebee2600be7576b9a904a6b10a665
1 file changed
+31
.github/workflows/v7-nonfinal-windows-nsis-acceptance-once.yml
+31
@@ -79,6 +79,37 @@ jobs:
79
$nextRuntime=Join-Path $install 'resources/standalone/node_modules/next/package.json'
80
Write-Host ('V7_PACKAGED_STANDALONE_SERVER_PRESENT='+[bool](Test-Path -LiteralPath $serverMain))
81
Write-Host ('V7_PACKAGED_NEXT_RUNTIME_PRESENT='+[bool](Test-Path -LiteralPath $nextRuntime))
82
+ # Probe the very same bundled Next server without Electron before
83
+ # asserting desktop bootstrap. Never expose process output or data.
84
+ $env:NODE_ENV='production'
85
+ $env:HOSTNAME='127.0.0.1'
86
+ $env:PORT='3210'
87
+ $standaloneNode=Start-Process -FilePath 'node.exe' -ArgumentList @($serverMain) -WorkingDirectory (Split-Path $serverMain) -PassThru -RedirectStandardError (Join-Path $env:RUNNER_TEMP 'nonfinal-direct-server-err.txt') -RedirectStandardOutput (Join-Path $env:RUNNER_TEMP 'nonfinal-direct-server-out.txt')
88
+ try {
89
+ $nodeReady=$false
90
+ for($probe=0;$probe -lt 55;$probe++){
91
+ try {
92
+ $nodeResult=Invoke-RestMethod -Uri 'http://127.0.0.1:3210/api/ready' -TimeoutSec 2
93
+ if($nodeResult.status -eq 'ready' -and $nodeResult.bankAdapter -eq 'disabled'){
94
+ $nodeReady=$true
95
+ break
96
+ }
97
+ }catch{}
98
+ if($standaloneNode.HasExited){break}
99
+ Start-Sleep -Milliseconds 400
100
+ }
101
+ Write-Host ('V7_PACKAGED_DIRECT_NODE_READY='+[bool]$nodeReady)
102
+ Write-Host ('V7_PACKAGED_DIRECT_NODE_EXITED='+[bool]$standaloneNode.HasExited)
103
+ if(!$nodeReady){throw 'BUNDLED_STANDALONE_SERVER_DIRECT_NODE_NOT_READY'}
104
+ }finally{
105
+ if(!$standaloneNode.HasExited){& taskkill.exe /PID $standaloneNode.Id /T /F *> $null}
106
+ for($probe=0;$probe -lt 20;$probe++){
107
+ $portOpen=@(Get-NetTCPConnection -LocalPort 3210 -State Listen -ErrorAction SilentlyContinue)
108
+ if($portOpen.Count -eq 0){break}
109
+ Start-Sleep -Milliseconds 250
110
+ }
111
+ }
112
+ Write-Host 'GATE_PASS_BUNDLED_STANDALONE_DIRECT_NODE_READY'
113
$desktop=Start-Process -FilePath $program[0].FullName -PassThru -RedirectStandardError $diagnosticError -RedirectStandardOutput $diagnosticOut
114
$ready=$null
115
for($i=0;$i -lt 40;$i++){