Move Get-IniContent, Out-IniFile, WaitForSuccess

- These scripts are universally useful and should be maintained once
This commit is contained in:
Iristyle
2012-10-22 15:13:00 -04:00
parent dd0265e871
commit 89bb12428f
6 changed files with 4 additions and 24 deletions

24
core/WaitForSuccess.ps1 Normal file
View File

@@ -0,0 +1,24 @@
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
}