File tree Expand file tree Collapse file tree
AwakeCoding.OpenSpecs/Public Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,15 +163,18 @@ function Save-OpenSpecDocument {
163163 }
164164
165165 $moduleBase = (Get-Module - Name ' AwakeCoding.OpenSpecs' | Select-Object - First 1 ).ModuleBase
166+ $openSpecRequestPath = if ($moduleBase ) { Join-Path - Path $moduleBase - ChildPath ' Private\Invoke-OpenSpecRequest.ps1' } else { $null }
166167 $useParallel = $Parallel -and $PSVersionTable.PSVersion.Major -ge 7 -and $toDownload.Count -gt 1
167168 $results = if ($useParallel ) {
168169 $toDownload | ForEach-Object - Parallel {
169170 $link = $_.Link
170171 $destination = $_.Destination
171172 try {
172- $currentModule = Get-Module - Name ' AwakeCoding.OpenSpecs' | Select-Object - First 1
173- if (-not $currentModule -and $using :moduleBase ) {
174- Import-Module (Join-Path - Path $using :moduleBase - ChildPath ' AwakeCoding.OpenSpecs.psd1' ) - Force | Out-Null
173+ if (-not (Get-Command - Name ' Invoke-OpenSpecRequest' - CommandType Function - ErrorAction SilentlyContinue)) {
174+ if (-not $using :openSpecRequestPath -or -not (Test-Path - LiteralPath $using :openSpecRequestPath - PathType Leaf)) {
175+ throw ' Invoke-OpenSpecRequest helper script not found for parallel download.'
176+ }
177+ . $using :openSpecRequestPath
175178 }
176179 Invoke-OpenSpecRequest - Uri $link.Url - OutFile $destination | Out-Null
177180 [pscustomobject ]@ {
You can’t perform that action at this time.
0 commit comments