@@ -26,57 +26,35 @@ jobs:
2626
2727 - name : Install MetaTrader5
2828 shell : pwsh
29+ timeout-minutes : 5
2930 run : |
31+ # Set installation parameters
3032 $installDir = "$env:GITHUB_WORKSPACE\MT5Portable"
33+ $installerPath = "$env:GITHUB_WORKSPACE\mt5setup.exe"
3134
32- # Clean previous installations
33- if (Test-Path $installDir) {
34- Remove-Item -Recurse -Force $installDir
35- }
36-
37- # Verify installer exists
38- if (-not (Test-Path "$env:GITHUB_WORKSPACE\mt5setup.exe")) {
39- Write-Error "Installer not found!"
40- exit 1
41- }
42-
43- # Run installer with timeout
44- $process = Start-Process "$env:GITHUB_WORKSPACE\mt5setup.exe" `
45- -ArgumentList @(
46- "/S",
47- "/portable=$installDir",
48- "/skipupdate"
49- ) `
50- -PassThru `
51- -NoNewWindow
35+ # Run installer with extended timeout
36+ $process = Start-Process $installerPath -ArgumentList @(
37+ "/S",
38+ "/portable=`"$installDir`"",
39+ "/skipupdate"
40+ ) -PassThru -NoNewWindow
5241
53- try {
54- # Wait with timeout (120 seconds)
55- if (-not $process.WaitForExit(120000)) {
56- Write-Error "Installer timed out after 2 minutes"
57- Stop-Process -Id $process.Id -Force -ErrorAction SilentlyContinue
58- exit 1
59- }
60-
61- # Verify exit code
62- if ($process.ExitCode -ne 0) {
63- Write-Error "Installer failed with exit code $($process.ExitCode)"
64- exit 1
65- }
66- }
67- catch {
68- Write-Error "Installation error: $_"
69- exit 1
42+ # Wait up to 4 minutes for installation
43+ if (-not $process.WaitForExit(240000)) {
44+ Write-Error "Installation timed out after 4 minutes"
45+ exit 1
7046 }
7147
72- # Verify installation
48+ # Verify successful installation
7349 if (-not (Test-Path "$installDir\terminal64.exe")) {
74- Get-ChildItem $installDir -Recurse | Out-Host
75- Write-Error "Installation verification failed"
76- exit 1
50+ Write-Error "Installation failed - terminal.exe missing"
51+ # Add diagnostic info
52+ Write-Host "Installation directory contents:"
53+ Get-ChildItem $installDir -Recurse | Format-List
54+ exit 1
7755 }
7856
79- Write-Host "MT5 installed successfully in $installDir"
57+ Write-Host "MT5 installed successfully to $installDir"
8058
8159 - name : Launch MetaTrader5
8260 run : |
0 commit comments