diff --git a/32 b/32 index b812801..04f38ae 100644 --- a/32 +++ b/32 @@ -110,7 +110,12 @@ function Main { if (![string]::IsNullOrEmpty($regionalWorkaround)) { $argumentList += $regionalWorkaround } - Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + $proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + if ($proc.ExitCode -ne 0) { + Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..." + $argsRetry = $argumentList + "--check-certificate=false" + Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait + } } # --- Check Signature --- diff --git a/64 b/64 index 1c6945e..d88203e 100644 --- a/64 +++ b/64 @@ -131,7 +131,12 @@ function Main { if (![string]::IsNullOrEmpty($regionalWorkaround)) { $argumentList += $regionalWorkaround } - Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + $proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + if ($proc.ExitCode -ne 0) { + Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..." + $argsRetry = $argumentList + "--check-certificate=false" + Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait + } } # --- Check Signature --- diff --git a/dx b/dx index 25578c4..182cc72 100644 --- a/dx +++ b/dx @@ -107,7 +107,12 @@ function Main { if (![string]::IsNullOrEmpty($regionalWorkaround)) { $argumentList += $regionalWorkaround } - Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + $proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + if ($proc.ExitCode -ne 0) { + Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..." + $argsRetry = $argumentList + "--check-certificate=false" + Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait + } } # --- Check Signature --- diff --git a/index.html b/index.html index eb1e20d..b2219e6 100644 --- a/index.html +++ b/index.html @@ -130,7 +130,12 @@ function Main { if (![string]::IsNullOrEmpty($regionalWorkaround)) { $argumentList += $regionalWorkaround } - Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + $proc = Start-Process -FilePath $aria2Exe -ArgumentList $argumentList -NoNewWindow -Wait + if ($proc.ExitCode -ne 0) { + Write-Warning "aria2c failed (exit code $($proc.ExitCode)). Retrying with --check-certificate=false..." + $argsRetry = $argumentList + "--check-certificate=false" + Start-Process -FilePath $aria2Exe -ArgumentList $argsRetry -NoNewWindow -Wait + } } # --- Check Signature ---