File tree Expand file tree Collapse file tree 2 files changed +13
-9
lines changed
Expand file tree Collapse file tree 2 files changed +13
-9
lines changed Original file line number Diff line number Diff line change 7272 }
7373
7474 # Resolve implicit artifact references
75- foreach ($pair in $Parameters.GetEnumerator ( )) {
76- if ($pair .Value -notlike ' %!*!%' ) { continue }
75+ foreach ($key in $ ( $ Parameters.Keys )) {
76+ if ($Parameters . $key -notlike ' %!*!%' ) { continue }
7777
78- $artifactName = $pair .Value -replace ' ^%!(.+?)!%$' , ' $1'
79- $Parameters [$pair . Key ] = (Get-PSMDBuildArtifact - Name $artifactName ).Value
78+ $artifactName = $Parameters . $key -replace ' ^%!(.+?)!%$' , ' $1'
79+ $Parameters [$Key ] = (Get-PSMDBuildArtifact - Name $artifactName ).Value
8080 }
8181
8282 $Parameters
Original file line number Diff line number Diff line change 22 param (
33 $Parameters
44 )
5+
6+ trap {
7+ if ($workingDirectory ) {
8+ Remove-Item - Path $workingDirectory - Recurse - Force - ErrorAction SilentlyContinue
9+ }
10+ throw $_
11+ }
512
613 $rootPath = $Parameters.RootPath
714 $actualParameters = $Parameters.Parameters
1118 throw " No Sessions specified!"
1219 }
1320
14- if ($actualParameters.Session | Where-Object State -NE Open ) {
21+ if ($actualParameters.Session | Where-Object State -NE Opened ) {
1522 throw " Sessions not open!"
1623 }
1724 if ($actualParameters.Repository -and (-not (Get-PSRepository - Name $actualParameters.Repository - ErrorAction Ignore))) {
2936 # region Prepare modules to transfer
3037 $workingDirectory = Join-Path - Path (Get-PSFPath - Name temp) - ChildPath " psmd_action_$ ( Get-Random ) "
3138 $null = New-Item - Path $workingDirectory - ItemType Directory - Force - ErrorAction Stop
32- trap {
33- Remove-Item - Path $workingDirectory - Recurse - Force - ErrorAction SilentlyContinue
34- throw $_
35- }
3639
3740 $saveModuleParam = @ {
3841 Path = $workingDirectory
6467 if (-not $actualParameters.NoDelete ) {
6568 Invoke-Command - Session $actualParameters.Session - ScriptBlock {
6669 param ($Name )
70+ if (-not (Test-Path - Path " $env: ProgramFiles \WindowsPowerShell\Modules\$Name " )) { return }
6771 Remove-Item - Path " $env: ProgramFiles \WindowsPowerShell\Modules\$Name " - Recurse - Force
6872 } - ArgumentList $moduleFolder.Name
6973 }
You can’t perform that action at this time.
0 commit comments