Skip to content

Commit

Permalink
馃懛 Updates Build Scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
brucificus committed Aug 26, 2023
1 parent a349142 commit 2c39154
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions build/funcs/Get-ModuleExports.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ function Get-ModuleExports {
"FormatFiles" = @()
}
try {
Set-Variable -Name PWSHRC_FORCE_MODULES_EXPORT_UNSUPPORTED -Value $true -Scope Global -Option Constant
[System.Management.Automation.PSModuleInfo] $moduleInfo = Import-Module -Name $Psm1Path -Force -DisableNameChecking -PassThru
if (-not $moduleInfo) {
if ($null -eq $moduleInfo) {
throw "Failed to import module from path '$Psm1Path'."
}
$results["Functions"] += @($moduleInfo.ExportedFunctions.Keys)
Expand All @@ -32,7 +33,8 @@ function Get-ModuleExports {
$results["DscResources"] += @($moduleInfo.ExportedDscResources)
$results["FormatFiles"] += @($moduleInfo.ExportedFormatFiles)
} finally {
if ($moduleInfo) {
Remove-Variable -Name PWSHRC_FORCE_MODULES_EXPORT_UNSUPPORTED -Scope Global -ErrorAction SilentlyContinue
if ($null -ne $moduleInfo) {
$moduleInfo | Remove-Module -Force
}
}
Expand Down

0 comments on commit 2c39154

Please sign in to comment.