Skip to content

Commit

Permalink
Move Pop-Location to finally block psake#135
Browse files Browse the repository at this point in the history
  • Loading branch information
DaveSenn committed Jan 8, 2017
1 parent d6e4cd3 commit 10a1460
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions psake.psm1
Expand Up @@ -144,7 +144,13 @@ function Exec
[Parameter(Position=1,Mandatory=0)][string]$errorMessage = ($msgs.error_bad_command -f $cmd),
[Parameter(Position=2,Mandatory=0)][int]$maxRetries = 0,
[Parameter(Position=3,Mandatory=0)][string]$retryTriggerErrorPattern = $null
[Parameter(Position=4,Mandatory=0)][string]$workingDirectory = $null
)

if($workingDirectory)
{
Push-Location -Path $workingDirectory
}

$tryCount = 1

Expand Down Expand Up @@ -177,6 +183,13 @@ function Exec

[System.Threading.Thread]::Sleep([System.TimeSpan]::FromSeconds(1))
}
finally
{
if($workingDirectory)
{
Pop-Location
}
}
}
while ($true)
}
Expand Down

0 comments on commit 10a1460

Please sign in to comment.