Skip to content

Commit b5ee580

Browse files
fix: Improving fault tolerance ( Fixes PoshWeb#21 )
1 parent 4c0be2b commit b5ee580

1 file changed

Lines changed: 14 additions & 8 deletions

File tree

build.ps1

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,19 @@ $StartTime = [DateTime]::Now
8989

9090
& {
9191
foreach ($file in Get-ChildItem -filter build.with.*.ps1) {
92-
$techniqueName = $file.Name -replace '\.build\.with' -replace '\.ps1$'
93-
$script = (Get-Command $file.FullName -CommandType ExternalScript).ScriptBlock
94-
$time = Measure-Command { . $file.FullName }
95-
[PSCustomObject]@{
96-
Technique = $techniqueName
97-
Time = $time
98-
Script = $script
92+
try {
93+
$techniqueName = $file.Name -replace '\.build\.with' -replace '\.ps1$'
94+
$script = (Get-Command $file.FullName -CommandType ExternalScript).ScriptBlock
95+
$time = Measure-Command { . $file.FullName }
96+
[PSCustomObject]@{
97+
Technique = $techniqueName
98+
Time = $time
99+
Script = $script
100+
}
101+
} catch {
102+
Write-Warning "$file encountered an error: $_"
99103
}
104+
100105
}
101106
} | Tee-Object -Variable buildTimes
102107

@@ -238,5 +243,6 @@ Remove-Item -Recurse -Force ./astrodev
238243

239244
Pop-Location
240245

246+
# Set our last exit code to 0
241247
$LASTEXITCODE = 0
242-
248+
exit 0

0 commit comments

Comments
 (0)