functions/appdev/Invoke-Alc.ps1

function Invoke-Alc {
    [CmdletBinding()]
    param (
        $AlcExe,
        $CompilerParameter
    )
    
    begin {
        Test-Path -Path $AlcExe -PathType Leaf -ErrorAction:Stop
        Write-Debug "alc $([string]::Join(' ', $CompilerParameter))"
    }
    
    process {
        & $AlcExe $CompilerParameter
    }
    
    end {
        if ($LASTEXITCODE -ne 0 -and $LASTEXITCODE -ne -1073740791) {
            Write-Warning "Compilation failed (LASTEXITCODE: $($LASTEXITCODE))"
        }
    }
}