Skip to content

Commit

Permalink
Merge branch 'pr2006' into stable
Browse files Browse the repository at this point in the history
* pr2006:
  (GH-2051) Fix: workingDirectory always replaced w/cacheLocation
  • Loading branch information
ferventcoder committed May 16, 2020
2 parents 7298fd8 + 02ea65e commit 8d78c0a
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,20 +118,22 @@ param(
[parameter(Mandatory=$false)][switch] $minimized,
[parameter(Mandatory=$false)][switch] $noSleep,
[parameter(Mandatory=$false)] $validExitCodes = @(0),
[parameter(Mandatory=$false)][string] $workingDirectory = $(Get-Location -PSProvider 'FileSystem'),
[parameter(Mandatory=$false)][string] $workingDirectory = $null,
[parameter(Mandatory=$false)][string] $sensitiveStatements = '',
[parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments
)
[string]$statements = $statements -join ' '

Write-FunctionCallLogMessage -Invocation $MyInvocation -Parameters $PSBoundParameters

if ($workingDirectory -eq $null -or $workingDirectory.ProviderPath -eq $null) {
Write-Debug "Unable to use current location for Working Directory. Using Cache Location instead."
$workingDirectory = $env:TEMP
if ($workingDirectory -eq $null) {
$pwd = $(Get-Location -PSProvider 'FileSystem')
if ($pwd -eq $null -or $pwd.ProviderPath -eq $null) {
Write-Debug "Unable to use current location for Working Directory. Using Cache Location instead."
$workingDirectory = $env:TEMP
}
$workingDirectory = $pwd.ProviderPath
}
$workingDirectory = $workingDirectory.ProviderPath

$alreadyElevated = $false
if (Test-ProcessAdminRights) {
$alreadyElevated = $true
Expand Down

0 comments on commit 8d78c0a

Please sign in to comment.