Skip to content

Commit 7198d81

Browse files
committed
Forget try/catch
1 parent fcab671 commit 7198d81

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

PSCompatibilityCollector/PSCompatibilityCollector.psm1

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,11 @@
22
# Licensed under the MIT License.
33

44
# Add the relevant binary module
5-
try
5+
if ($PSVersionTable.PSVersion.Major -ge 6)
66
{
7-
if ($PSVersionTable.PSVersion.Major -ge 6)
8-
{
9-
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
10-
}
11-
else
12-
{
13-
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
14-
}
7+
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'netstandard2.0', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
158
}
16-
catch
9+
else
1710
{
18-
# Do nothing
11+
Import-Module ([System.IO.Path]::Combine($PSScriptRoot, 'net452', 'Microsoft.PowerShell.CrossCompatibility.dll')) -Force
1912
}

0 commit comments

Comments
 (0)