141 153
This commit is contained in:
15
samy.ps1
15
samy.ps1
@@ -139,12 +139,21 @@ $chunks = @(
|
|||||||
|
|
||||||
|
|
||||||
foreach ($c in $chunks) {
|
foreach ($c in $chunks) {
|
||||||
$content = Import-SamyChunk -Url $c.Url -Name $c.Name
|
try {
|
||||||
. ([ScriptBlock]::Create($content))
|
$content = Import-SamyChunk -Url $c.Url -Name $c.Name -ErrorAction Stop
|
||||||
Write-Host "[Success] Loaded: $($c.Name)" -ForegroundColor Green
|
. ([ScriptBlock]::Create($content))
|
||||||
|
Write-Host "[Success] $($c.Name)" -ForegroundColor Green
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
$msg = $_.Exception.Message
|
||||||
|
if ([string]::IsNullOrWhiteSpace($msg)) { $msg = "$_" }
|
||||||
|
Write-Host "[Failed] $($c.Name): $msg" -ForegroundColor Red
|
||||||
|
throw # or continue
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (-not (Get-Command Invoke-ScriptAutomationMonkey -ErrorAction SilentlyContinue)) {
|
if (-not (Get-Command Invoke-ScriptAutomationMonkey -ErrorAction SilentlyContinue)) {
|
||||||
throw "Bootstrap loaded chunks, but Invoke-ScriptAutomationMonkey was not found. Ensure src/core.ps1 defines it."
|
throw "Bootstrap loaded chunks, but Invoke-ScriptAutomationMonkey was not found. Ensure src/core.ps1 defines it."
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user