@@ -165,39 +165,30 @@ jobs:
165
165
with :
166
166
name : GeneralsMD-${{ matrix.preset }}+t+e
167
167
path : build
168
+ - name : Move Replay files to correct folder
169
+ shell : pwsh
170
+ run : |
171
+ $source = "GeneralsMD\Replays"
172
+ $destination = "$env:USERPROFILE\Documents\Command and Conquer Generals Zero Hour\Replays"
173
+
174
+ New-Item -ItemType Directory -Path $destination -Force | Out-Null
175
+ Get-ChildItem -Path $source -File | Move-Item -Destination $destination
168
176
- name : Run Replay Compatibility Tests
169
177
shell : pwsh
170
178
run : |
171
179
$exePath = "build\generalszh.exe"
172
- $replayPattern = "GeneralsMD\Replays\*.rep"
173
- $args = "-jobs", "2", "-headless", "-replay", "$replayPattern"
174
180
175
181
Write-Host "Checking if executable exists at: $exePath"
176
182
if (-not (Test-Path $exePath)) {
177
- Write-Host "ERROR: Executable not found at $exePath"
178
- exit 1
179
- }
180
-
181
- $commandLine = "$exePath $($args -join ' ')"
182
- Write-Host "Running: $commandLine"
183
-
184
- try {
185
- & $exePath @args
186
- if (-not $?) {
187
- Write-Host "ERROR: Process failed to start or exited with an error."
183
+ Write-Host "ERROR: Executable not found at $exePath"
188
184
exit 1
189
- }
185
+ }
190
186
191
- $exitCode = $LASTEXITCODE
192
- if ($null -eq $exitCode) {
193
- Write-Host "WARNING: Process did not return an exit code. Assuming failure."
194
- exit 1
195
- }
187
+ $process = Start-Process -FilePath $exePath -ArgumentList "-jobs 2 -headless" -Wait -PassThru
188
+ $exitCode = $process.ExitCode
196
189
197
- Write-Host "Process exited with code $exitCode"
198
- exit $exitCode
199
- } catch {
200
- Write-Host "ERROR: Exception occurred while running the process."
201
- Write-Host $_
202
- exit 1
190
+ # Handle non-zero exit code
191
+ if ($exitCode -ne 0) {
192
+ Write-Host "Process failed with exit code $exitCode"
193
+ throw "Executable failed with exit code $exitCode"
203
194
}
0 commit comments