Correct case of $PWD special variable

This commit is contained in:
xtqqczze 2020-01-13 19:24:10 +00:00
parent 62aee9356a
commit 4a9d70fdcd
14 changed files with 37 additions and 37 deletions

View file

@ -438,7 +438,7 @@ Fix steps:
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop"
}
Write-Log "Run dotnet $Arguments from $pwd"
Write-Log "Run dotnet $Arguments from $PWD"
Start-NativeExecution { dotnet $Arguments }
Write-Log "PowerShell output: $($Options.Output)"
@ -456,14 +456,14 @@ Fix steps:
$Arguments += "/property:SDKToUse=Microsoft.NET.Sdk.WindowsDesktop"
}
Write-Log "Run dotnet $Arguments from $pwd"
Write-Log "Run dotnet $Arguments from $PWD"
Start-NativeExecution { dotnet $Arguments }
Write-Log "PowerShell output: $($Options.Output)"
try {
Push-Location $globalToolSrcFolder
$Arguments += "--output", $publishPath
Write-Log "Run dotnet $Arguments from $pwd to build global tool entry point"
Write-Log "Run dotnet $Arguments from $PWD to build global tool entry point"
Start-NativeExecution { dotnet $Arguments }
}
finally {
@ -1646,7 +1646,7 @@ function Install-Dotnet {
} else {
# dotnet-install.ps1 uses APIs that are not supported in .NET Core, so we run it with Windows PowerShell
$fullPSPath = Join-Path -Path $env:windir -ChildPath "System32\WindowsPowerShell\v1.0\powershell.exe"
$fullDotnetInstallPath = Join-Path -Path $pwd.Path -ChildPath $installScript
$fullDotnetInstallPath = Join-Path -Path $PWD.Path -ChildPath $installScript
Start-NativeExecution { & $fullPSPath -NoLogo -NoProfile -File $fullDotnetInstallPath -Channel $Channel -Version $Version }
}
}

View file

@ -706,7 +706,7 @@ namespace StackTest {
@{ parameter = '-wo' }
) {
param($parameter)
$output = & $powershell -NoProfile $parameter ~ -Command "`$pwd.Path"
$output = & $powershell -NoProfile $parameter ~ -Command "`$PWD.Path"
$output | Should -BeExactly $((Get-Item ~).FullName)
}

View file

@ -231,7 +231,7 @@ Describe 'Positive Parse Properties Tests' -Tags "CI" {
$Matches
$error[0]
$error
$pwd
$PWD
foreach ($i in 1..10) {$foreach}
switch ($i)
{

View file

@ -216,7 +216,7 @@ Describe "Ampersand background test" -tag "CI","Slow" {
}
It "starts in the current directory" {
$j = Get-Location | Foreach-Object -MemberName Path &
Receive-Job -Wait $j | Should -Be ($pwd.Path)
Receive-Job -Wait $j | Should -Be ($PWD.Path)
}
It "Test that output redirection is done in the background job" {
$j = Write-Output hello > $TESTDRIVE/hello.txt &

View file

@ -202,7 +202,7 @@ Describe "Set-Location" -Tags "CI" {
}
It 'The LocationChangedAction should fire when changing location' {
$initialPath = $pwd
$initialPath = $PWD
$oldPath = $null
$newPath = $null
$eventSessionState = $null
@ -214,7 +214,7 @@ Describe "Set-Location" -Tags "CI" {
(Get-Variable newPath).Value = $_.newPath
}
Set-Location ..
$newPath.Path | Should -Be $pwd.Path
$newPath.Path | Should -Be $PWD.Path
$oldPath.Path | Should -Be $initialPath.Path
$eventSessionState | Should -Be $ExecutionContext.SessionState
$eventRunspace | Should -Be ([runspace]::DefaultRunspace)

View file

@ -101,8 +101,8 @@ Describe 'ForEach-Object -Parallel Basic Tests' -Tags 'CI' {
}
It 'Verifies that the current working directory is preserved' {
$parallelScriptLocation = 1..1 | ForEach-Object -Parallel { $pwd }
$parallelScriptLocation.Path | Should -BeExactly $pwd.Path
$parallelScriptLocation = 1..1 | ForEach-Object -Parallel { $PWD }
$parallelScriptLocation.Path | Should -BeExactly $PWD.Path
}
}
@ -307,10 +307,10 @@ Describe 'ForEach-Object -Parallel -AsJob Basic Tests' -Tags 'CI' {
}
It 'Verifies that the current working directory is preserved' {
$job = 1..1 | ForEach-Object -AsJob -Parallel { $pwd }
$job = 1..1 | ForEach-Object -AsJob -Parallel { $PWD }
$parallelScriptLocation = $job | Wait-Job | Receive-Job
$job | Remove-Job
$parallelScriptLocation.Path | Should -BeExactly $pwd.Path
$parallelScriptLocation.Path | Should -BeExactly $PWD.Path
}
}

View file

@ -4,7 +4,7 @@
Describe "Select-String" -Tags "CI" {
BeforeAll {
$nl = [Environment]::NewLine
$currentDirectory = $pwd.Path
$currentDirectory = $PWD.Path
}
AfterAll {

View file

@ -81,7 +81,7 @@ Describe 'Basic Job Tests' -Tags 'Feature' {
It 'Can use the user specified working directory parameter with whitespace' {
$path = Join-Path -Path $TestDrive -ChildPath "My Dir"
$null = New-Item -ItemType Directory -Path "$path"
$job = Start-Job -ScriptBlock { $pwd } -WorkingDirectory $path | Wait-Job
$job = Start-Job -ScriptBlock { $PWD } -WorkingDirectory $path | Wait-Job
$jobOutput = Receive-Job $job
$jobOutput | Should -BeExactly $path.ToString()
}
@ -89,13 +89,13 @@ Describe 'Basic Job Tests' -Tags 'Feature' {
It 'Can use the user specified working directory parameter with quote' -Skip:($IsWindows) {
$path = Join-Path -Path $TestDrive -ChildPath "My ""Dir"
$null = New-Item -ItemType Directory -Path "$path"
$job = Start-Job -ScriptBlock { $pwd } -WorkingDirectory $path | Wait-Job
$job = Start-Job -ScriptBlock { $PWD } -WorkingDirectory $path | Wait-Job
$jobOutput = Receive-Job $job
$jobOutput | Should -BeExactly $path.ToString()
}
It 'Verifies the working directory parameter path with trailing backslash' -Skip:(! $IsWindows) {
$job = Start-Job { $pwd } -WorkingDirectory '\' | Wait-Job
$job = Start-Job { $PWD } -WorkingDirectory '\' | Wait-Job
$job.JobStateInfo.State | Should -BeExactly 'Completed'
}
@ -106,10 +106,10 @@ Describe 'Basic Job Tests' -Tags 'Feature' {
}
It 'Verifies that the current working directory is preserved' {
$job = Start-Job -ScriptBlock { $pwd }
$job = Start-Job -ScriptBlock { $PWD }
$location = $job | Wait-Job | Receive-Job
$job | Remove-Job
$location.Path | Should -BeExactly $pwd.Path
$location.Path | Should -BeExactly $PWD.Path
}
It "Create job with native command" {

View file

@ -209,7 +209,7 @@ function Send-VstsLogFile {
$Path
)
$logFolder = Join-Path -path $pwd -ChildPath 'logfile'
$logFolder = Join-Path -path $PWD -ChildPath 'logfile'
if(!(Test-Path -Path $logFolder))
{
$null = New-Item -Path $logFolder -ItemType Directory

View file

@ -615,7 +615,7 @@ function Install-OpenCover
.Description
Invoke-OpenCover runs tests under OpenCover by executing tests on PowerShell located at $PowerShellExeDirectory.
.EXAMPLE
Invoke-OpenCover -TestPath $pwd/test/powershell -PowerShellExeDirectory $pwd/src/powershell-win-core/bin/CodeCoverage/netcoreapp1.0/win7-x64
Invoke-OpenCover -TestPath $PWD/test/powershell -PowerShellExeDirectory $PWD/src/powershell-win-core/bin/CodeCoverage/netcoreapp1.0/win7-x64
#>
function Invoke-OpenCover
{

View file

@ -21,7 +21,7 @@ function New-SelfSignedCertificate
#Path to save generated Certificate
[ValidateNotNullOrEmpty()]
[string] $CertificateFilePath = "$pwd\PowerShell.cer",
[string] $CertificateFilePath = "$PWD\PowerShell.cer",
#Path to save generated pvk file
[ValidateNotNullOrEmpty()]
@ -55,7 +55,7 @@ function ConvertTo-Pfx
#Path to Certificate file
[ValidateNotNullOrEmpty()]
[string] $CertificateFilePath = "$pwd\PowerShell.cer",
[string] $CertificateFilePath = "$PWD\PowerShell.cer",
#Path to pvk file
[ValidateNotNullOrEmpty()]

View file

@ -190,7 +190,7 @@ function Invoke-CIxUnit
throw "CoreCLR pwsh.exe was not built"
}
$xUnitTestResultsFile = Join-Path -Path $pwd -childpath "xUnitTestResults.xml"
$xUnitTestResultsFile = Join-Path -Path $PWD -childpath "xUnitTestResults.xml"
Start-PSxUnit -xUnitTestResultsFile $xUnitTestResultsFile
Push-Artifact -Path $xUnitTestResultsFile -name xunit
@ -239,8 +239,8 @@ function Invoke-CITest
$env:CoreOutput = Split-Path -Parent (Get-PSOutput -Options (Get-PSOptions))
Write-Host -Foreground Green 'Run CoreCLR tests'
$testResultsNonAdminFile = "$pwd\TestsResultsNonAdmin-$TagSet.xml"
$testResultsAdminFile = "$pwd\TestsResultsAdmin-$TagSet.xml"
$testResultsNonAdminFile = "$PWD\TestsResultsNonAdmin-$TagSet.xml"
$testResultsAdminFile = "$PWD\TestsResultsAdmin-$TagSet.xml"
if(!(Test-Path "$env:CoreOutput\pwsh.exe"))
{
throw "CoreCLR pwsh.exe was not built"
@ -269,7 +269,7 @@ function Invoke-CITest
$featureName = $entry.Key
$testFiles = $entry.Value
$expFeatureTestResultFile = "$pwd\TestsResultsNonAdmin.$featureName.xml"
$expFeatureTestResultFile = "$PWD\TestsResultsNonAdmin.$featureName.xml"
$arguments['OutputFile'] = $expFeatureTestResultFile
$arguments['ExperimentalFeatureName'] = $featureName
if ($testFiles.Count -eq 0) {
@ -308,7 +308,7 @@ function Invoke-CITest
$featureName = $entry.Key
$testFiles = $entry.Value
$expFeatureTestResultFile = "$pwd\TestsResultsAdmin.$featureName.xml"
$expFeatureTestResultFile = "$PWD\TestsResultsAdmin.$featureName.xml"
$arguments['OutputFile'] = $expFeatureTestResultFile
$arguments['ExperimentalFeatureName'] = $featureName
if ($testFiles.Count -eq 0)
@ -407,11 +407,11 @@ function Compress-CoverageArtifacts
Add-Type -AssemblyName System.IO.Compression.FileSystem
$resolvedPath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath((Join-Path $PSScriptRoot '..\test\tools\OpenCover'))
$zipOpenCoverPath = Join-Path $pwd 'OpenCover.zip'
$zipOpenCoverPath = Join-Path $PWD 'OpenCover.zip'
[System.IO.Compression.ZipFile]::CreateFromDirectory($resolvedPath, $zipOpenCoverPath)
$null = $artifacts.Add($zipOpenCoverPath)
$zipCodeCoveragePath = Join-Path $pwd "CodeCoverage.zip"
$zipCodeCoveragePath = Join-Path $PWD "CodeCoverage.zip"
Write-Verbose "Zipping ${CodeCoverageOutput} into $zipCodeCoveragePath" -verbose
[System.IO.Compression.ZipFile]::CreateFromDirectory($CodeCoverageOutput, $zipCodeCoveragePath)
$null = $artifacts.Add($zipCodeCoveragePath)
@ -576,8 +576,8 @@ function Invoke-LinuxTestsCore
)
$output = Split-Path -Parent (Get-PSOutput -Options (Get-PSOptions))
$testResultsNoSudo = "$pwd/TestResultsNoSudo.xml"
$testResultsSudo = "$pwd/TestResultsSudo.xml"
$testResultsNoSudo = "$PWD/TestResultsNoSudo.xml"
$testResultsSudo = "$PWD/TestResultsSudo.xml"
$testExcludeTag = $ExcludeTag + 'RequireSudoOnUnix'
$noSudoPesterParam = @{
@ -603,7 +603,7 @@ function Invoke-LinuxTestsCore
$featureName = $entry.Key
$testFiles = $entry.Value
$expFeatureTestResultFile = "$pwd\TestResultsNoSudo.$featureName.xml"
$expFeatureTestResultFile = "$PWD\TestResultsNoSudo.$featureName.xml"
$noSudoPesterParam['OutputFile'] = $expFeatureTestResultFile
$noSudoPesterParam['ExperimentalFeatureName'] = $featureName
if ($testFiles.Count -eq 0) {
@ -638,7 +638,7 @@ function Invoke-LinuxTestsCore
$featureName = $entry.Key
$testFiles = $entry.Value
$expFeatureTestResultFile = "$pwd\TestResultsSudo.$featureName.xml"
$expFeatureTestResultFile = "$PWD\TestResultsSudo.$featureName.xml"
$sudoPesterParam['OutputFile'] = $expFeatureTestResultFile
$sudoPesterParam['ExperimentalFeatureName'] = $featureName
if ($testFiles.Count -eq 0)

View file

@ -2756,8 +2756,8 @@ function New-MSIPackage
if ($ProductNameSuffix) {
$packageName += "-$ProductNameSuffix"
}
$msiLocationPath = Join-Path $pwd "$packageName.msi"
$msiPdbLocationPath = Join-Path $pwd "$packageName.wixpdb"
$msiLocationPath = Join-Path $PWD "$packageName.msi"
$msiPdbLocationPath = Join-Path $PWD "$packageName.wixpdb"
if (!$Force.IsPresent -and (Test-Path -Path $msiLocationPath))
{

View file

@ -7,7 +7,7 @@ param (
[string] $branch = 'master',
[string] $location = "$pwd\powershell",
[string] $location = "$PWD\powershell",
[string] $destination = "$env:WORKSPACE",