Skip to content

Commit 19dc447

Browse files
committed
🪳 Fix bootstrap not handling some parameterized arguments properly
1 parent 3d17c2d commit 19dc447

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

ModuleFast.ps1

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ if ($PSVersionTable.PSVersion -lt '7.2.0') {
4343
throw [NotSupportedException]'The ModuleFast Bootstrap script requires PowerShell 7.2 or higher. Specific ModuleFast versions may have more strict requirements.'
4444
}
4545

46-
47-
4846
#We need to load the versioning assembly before we load the dependent classes
4947
#We inline this in order to keep ModuleFast self-contained
5048
function Import-NuGetVersioningAssembly {
@@ -101,11 +99,15 @@ if ($UseMain) {
10199
}
102100

103101
if ($installArgs) {
104-
Write-Debug "Detected we were started with args, running $Entrypoint $($installArgs -join ' ')"
105-
& $EntryPoint @installArgs
102+
try {
103+
Write-Debug "Detected we were started with args, running $Entrypoint $($installArgs -join ' ')"
104+
#TODO: Find a less gross way to do this than Invoke-Expression
105+
Invoke-Expression "$EntryPoint $($installArgs -join ' ')"
106+
} finally {
107+
#Remove the bootstrap module if args were specified, otherwise persist it in memory
108+
Remove-Module $bootstrapModule
109+
}
106110

107-
#Remove the bootstrap module if args were specified, otherwise persist it in memory
108-
Remove-Module $bootstrapModule
109111
}
110112

111113

0 commit comments

Comments
 (0)