Close scratch iteration 007 and harden runner output contracts

This commit is contained in:
master
2026-03-13 08:14:53 +02:00
parent 407ab84cbb
commit fe35801cc5
2 changed files with 90 additions and 2 deletions

View File

@@ -31,9 +31,21 @@ function Invoke-External {
Push-Location $WorkingDirectory
try {
& $FilePath @ArgumentList
$resolvedFilePath = $FilePath
if (Test-Path $FilePath) {
$resolvedFilePath = (Resolve-Path $FilePath).Path
}
if ([System.IO.Path]::GetExtension($resolvedFilePath).Equals('.ps1', [System.StringComparison]::OrdinalIgnoreCase)) {
$powershellPath = (Get-Command powershell.exe -ErrorAction Stop).Source
& $powershellPath -NoLogo -NoProfile -ExecutionPolicy Bypass -File $resolvedFilePath @ArgumentList 2>&1 | Out-Host
}
else {
& $resolvedFilePath @ArgumentList 2>&1 | Out-Host
}
if ($LASTEXITCODE -ne 0) {
throw "Command failed: $FilePath $($ArgumentList -join ' ')"
throw "Command failed: $resolvedFilePath $($ArgumentList -join ' ')"
}
}
finally {