寻找含Invoke-SafeCommand函数的可下载PowerShell NuGet模块
寻找包含Invoke-SafeCommand函数的NuGet PowerShell模块
我正在寻找可通过NuGet下载的PowerShell模块,要求该模块包含如下Invoke-SafeCommand函数:
function Invoke-SafeCommand { param ( [ScriptBlock]$ScriptBlock ) try { & $ScriptBlock } catch { Write-Host "An exception is thrown : $_" exit 1 } if ($LASTEXITCODE -ne 0) { Write-Host "The command return this last exit code : $LASTEXITCODE" exit $LASTEXITCODE } }
该函数用于检查所调用的C#控制台程序的退出码或异常。此PowerShell脚本将在Azure DevOps管道中运行,希望当C#控制台程序运行失败时,该脚本也能触发管道失败。
内容的提问来源于stack exchange,提问作者Sybaris
相关产品推荐
相关产品推荐

