Catch exception when used on FullCLR

This is the case when the module is used on FullCLR versions of
PowerShell (necessarily on Windows).
This commit is contained in:
Andrew Schwartzmeyer 2016-02-21 17:23:43 -08:00
parent 472b17d547
commit a7177c24e2

View File

@ -1,9 +1,15 @@
# TODO: use PowerShell to check OS when available
try {
$Runtime = [System.Runtime.InteropServices.RuntimeInformation]
$OSPlatform = [System.Runtime.InteropServices.OSPlatform]
$Linux = $Runtime::IsOSPlatform($OSPlatform::Linux)
$OSX = $Runtime::IsOSPlatform($OSPlatform::OSX)
$Windows = $Runtime::IsOSPlatform($OSPlatform::Windows)
} catch [System.Management.Automation.RuntimeException] {
$Linux = $false
$OSX = $false
$Windows = $true
}
function Start-PSBuild
{