mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 20:56:02 +00:00
Add clean block to script block as a peer to begin, process, and end to allow easy resource cleanup (#15177)
This commit is contained in:
1 parent
fa4bfb447e
commit
a32700a1c1
30 files changed
+3055
-644
No files matched your search
+8
-7
@@ -2823,13 +2823,14 @@ function Get-PSImplicitRemotingClientSideParameters
|
||||
|
||||
$clientSideParameters = Get-PSImplicitRemotingClientSideParameters $PSBoundParameters ${8}
|
||||
|
||||
$scriptCmd = {{ & $script:InvokeCommand `
|
||||
@clientSideParameters `
|
||||
-HideComputerName `
|
||||
-Session (Get-PSImplicitRemotingSession -CommandName '{0}') `
|
||||
-Arg ('{0}', $PSBoundParameters, $positionalArguments) `
|
||||
-Script {{ param($name, $boundParams, $unboundParams) & $name @boundParams @unboundParams }} `
|
||||
}}
|
||||
$scriptCmd = {{
|
||||
& $script:InvokeCommand `
|
||||
@clientSideParameters `
|
||||
-HideComputerName `
|
||||
-Session (Get-PSImplicitRemotingSession -CommandName '{0}') `
|
||||
-Arg ('{0}', $PSBoundParameters, $positionalArguments) `
|
||||
-Script {{ param($name, $boundParams, $unboundParams) & $name @boundParams @unboundParams }} `
|
||||
}}
|
||||
|
||||
$steppablePipeline = $scriptCmd.GetSteppablePipeline($myInvocation.CommandOrigin)
|
||||
$steppablePipeline.Begin($myInvocation.ExpectingInput, $ExecutionContext)
|
||||
|
||||
Reference in new issue
Block a user