Skip to content

Commit c09c484

Browse files
committed
Run invokeExpression in a child scope
1 parent 6a774b7 commit c09c484

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

ModuleFast.ps1

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,9 @@ if ($installArgs) {
102102
try {
103103
[string]$bootstrapScript = "$EntryPoint $($installArgs -join ' ')"
104104
Write-Debug "Detected we were started with args, running $bootstrapScript"
105-
#TODO: Find a less gross way to do this than Invoke-Expression
106-
Invoke-Expression $bootstrapScript
105+
#Because we are using a module entry point, we don't need a child scope, we can run in current scope which will just
106+
#pass to the module
107+
. ([scriptblock]::Create($bootstrapScript))
107108
} finally {
108109
#Remove the bootstrap module if args were specified, otherwise persist it in memory
109110
Remove-Module $bootstrapModule

0 commit comments

Comments
 (0)