vulcast-vertical/.github/scripts/utils.pwsh/Invoke-External.ps1
Vulcast c5b35d8ec8
Some checks are pending
Build Windows DLL / Build for Windows (push) Waiting to run
Add CI build infrastructure from OBS plugin template
Added GitHub Actions workflow and build scripts from
obsproject/obs-plugintemplate for Windows DLL builds.

Push to GitHub and go to Actions tab to build the DLL.
2026-06-29 23:08:27 +01:00

40 lines
997 B
PowerShell

function Invoke-External {
<#
.SYNOPSIS
Invokes a non-PowerShell command.
.DESCRIPTION
Runs a non-PowerShell command, and captures its return code.
Throws an exception if the command returns non-zero.
.EXAMPLE
Invoke-External 7z x $MyArchive
#>
if ( $args.Count -eq 0 ) {
throw 'Invoke-External called without arguments.'
}
if ( ! ( Test-Path function:Log-Information ) ) {
. $PSScriptRoot/Logger.ps1
}
$Command = $args[0]
$CommandArgs = @()
if ( $args.Count -gt 1) {
$CommandArgs = $args[1..($args.Count - 1)]
}
$_EAP = $ErrorActionPreference
$ErrorActionPreference = "Continue"
Log-Debug "Invoke-External: ${Command} ${CommandArgs}"
& $command $commandArgs
$Result = $LASTEXITCODE
$ErrorActionPreference = $_EAP
if ( $Result -ne 0 ) {
throw "${Command} ${CommandArgs} exited with non-zero code ${Result}."
}
}