Files
ChocolateyPackages/Sickbeard/tools/WaitForSuccess.ps1
Iristyle dd0265e871 SickBeard - Additional installer code
- Complete uninstall script undoes configuration changes to SABNzbd
 - Use new WaitForSuccess helper
 - Wait for SickBeard to be accepting reqs before modifying config.ini
 - PATH and PYTHONHOME need to be set for MACHINE so that SABNzbd
can find python.exe as SYSTEM to call sabToSickBeard.py
 - Config files should always be written as UTF8 (not Unicode or ASCII),
 - However, AutoProcess.cfg cannot have UTF8 BOM, so saving as ASCII
 - Replacing 0.0.0.0 with localhost
 - Support cloning into an empty Sick-Beard dir under site-packages
 - Minor logging tweaks
 - Use Season folders when sorting files
 - Make sure to trash processed files
2012-10-22 15:18:07 -04:00

25 lines
541 B
PowerShell

function WaitForSuccess([ScriptBlock] $script, [int]$seconds = 10,
[string]$description = 'operation to complete')
{
$skip = $false
Write-Host "Waiting up to $($seconds)s for $description..."
$result = 0..($seconds * 2) |
% {
if ($skip) { return $true }
$status = &$script
if ($status -eq $true)
{
$skip = $true
return $true
}
else
{
Start-Sleep -Milliseconds 500
}
return $false
} |
Select -Last 1
return $result
}