| 123456789101112 |
- param([Parameter(ValueFromRemainingArguments=$true)][string[]]$Command)
- $ErrorActionPreference='Stop'
- $delays=2,5,10,20,30
- $knownHosts=Join-Path $HOME '.ssh\known_hosts'
- for($i=0;$i -lt $delays.Count;$i++){
- & ssh -o StrictHostKeyChecking=yes -o "UserKnownHostsFile=$knownHosts" `
- -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=4 `
- edk2-uefi-lab @Command
- if($LASTEXITCODE -eq 0){exit 0}
- if($i -eq 4){throw 'REMOTE_NETWORK_UNSTABLE'}
- Start-Sleep -Seconds $delays[$i]
- }
|