File tree 2 files changed +17
-2
lines changed
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -216,9 +216,12 @@ function Install-ModuleFast {
216
216
HttpClient = $httpClient
217
217
Update = $Update -or $PSCmdlet.ParameterSetName -eq ' ModuleFastInfo'
218
218
}
219
- Install-ModuleFastHelper @installHelperParams
219
+ $installedModules = Install-ModuleFastHelper @installHelperParams
220
220
Write-Progress - Id 1 - Activity ' Install-ModuleFast' - Completed
221
221
Write-Verbose " `u{2705} All required modules installed! Exiting."
222
+ if ($PassThru ) {
223
+ Write-Output $installedModules
224
+ }
222
225
}
223
226
224
227
if ($CI ) {
@@ -761,14 +764,21 @@ function Install-ModuleFastHelper {
761
764
}
762
765
763
766
$installed = 0
764
- while ($installJobs.count -gt 0 ) {
767
+ $installedModules = while ($installJobs.count -gt 0 ) {
765
768
$ErrorActionPreference = ' Stop'
766
769
$completedJob = $installJobs | Wait-Job - Any
767
770
$completedJobContext = $completedJob | Receive-Job - Wait - AutoRemoveJob
768
771
if (-not $installJobs.Remove ($completedJob )) { throw ' Could not remove completed job from list. This is a bug, report it' }
769
772
$installed ++
770
773
Write-Verbose " $ ( $completedJobContext.Module ) `: Installed to $ ( $completedJobContext.InstallPath ) "
771
774
Write-Progress - Id 1 - Activity ' Install-ModuleFast' - Status " Install: $installed /$ ( $ModuleToInstall.count ) Modules" - PercentComplete ((($installed / $ModuleToInstall.count ) * 50 ) + 50 )
775
+ $context.Module.Location = $completedJobContext.InstallPath
776
+ # Output the module for potential future passthru
777
+ $context.Module
778
+ }
779
+
780
+ if ($PassThru ) {
781
+ return $installedModules
772
782
}
773
783
}
774
784
}
Original file line number Diff line number Diff line change @@ -621,6 +621,11 @@ Describe 'Install-ModuleFast' -Tag 'E2E' {
621
621
Test-Path $incompleteItemPath | Should - BeFalse
622
622
}
623
623
624
+ It ' PassThru only reports on installed modules' {
625
+ Install-ModuleFast @imfParams - Specification ' Pester=5.4.0' , ' Pester=5.4.1' - PassThru | Should - HaveCount 2
626
+ Install-ModuleFast @imfParams - Specification ' Pester=5.4.0' , ' Pester=5.4.1' - PassThru | Should - HaveCount 0
627
+ }
628
+
624
629
Describe ' GitHub Packages' {
625
630
It ' Gets Specific Module' {
626
631
$credential = [PSCredential ]::new(' Pester' , (Get-Secret - Name ' ReadOnlyPackagesGithubPAT' ))
You can’t perform that action at this time.
0 commit comments