Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
4f5bb46
Remove BOM, insert newline at EOF
xtqqczze Jan 13, 2020
d58e1ff
Correct case of $MyInvocation special variable
xtqqczze Jan 13, 2020
fbe459d
Correct case of $OFS special variable
xtqqczze Jan 13, 2020
f86f30c
Correct case of $NestedPromptLevel special variable
xtqqczze Jan 13, 2020
89e33f5
Correct case of $Matches special variable
xtqqczze Jan 13, 2020
04b292a
Correct case of $LASTEXITCODE special variable
xtqqczze Jan 13, 2020
7dd922a
Correct case of $StackTrace special variable
xtqqczze Jan 13, 2020
6663261
Correct case of $args special variable
xtqqczze Jan 13, 2020
66e0f08
Correct case of $this special variable
xtqqczze Jan 13, 2020
a051666
Correct case of $input special variable
xtqqczze Jan 13, 2020
42d5043
Correct case of $PSCmdlet special variable
xtqqczze Jan 13, 2020
b6a687b
Correct case of $error special variable
xtqqczze Jan 13, 2020
679702b
Correct case of $PSDefaultParameterValues special variable
xtqqczze Jan 13, 2020
62aee93
Correct case of $PSScriptRoot special variable
xtqqczze Jan 13, 2020
4a9d70f
Correct case of $PWD special variable
xtqqczze Jan 13, 2020
6014f4b
Correct case of $null special variable
xtqqczze Jan 13, 2020
47a3b4e
Correct case of $true special variable
xtqqczze Jan 13, 2020
bb58e2a
Correct case of $false special variable
xtqqczze Jan 13, 2020
9e5bb4e
Correct case of $PSModuleAutoLoadingPreference special variable
xtqqczze Jan 13, 2020
17d0e93
Correct case of $IsLinux special variable
xtqqczze Jan 13, 2020
72d52b7
Correct case of $IsMacOS special variable
xtqqczze Jan 13, 2020
94a73ca
Correct case of $IsWindows special variable
xtqqczze Jan 13, 2020
6d97b3a
Correct case of $IsCoreCLR special variable
xtqqczze Jan 13, 2020
6affae5
Correct case of $DebugPreference special variable
xtqqczze Jan 13, 2020
ca4edad
Correct case of $VerbosePreference special variable
xtqqczze Jan 13, 2020
b700c46
Correct case of $InformationPreference special variable
xtqqczze Jan 13, 2020
d0f2812
Correct case of $ExecutionContext special variable
xtqqczze Jan 13, 2020
7cb8dc4
Correct case of $HOME special variable
xtqqczze Jan 13, 2020
b5326a8
Correct case of $Host special variable
xtqqczze Jan 13, 2020
2251640
Correct case of $PID special variable
xtqqczze Jan 13, 2020
2782b73
Correct case of $PSCulture special variable
xtqqczze Jan 13, 2020
e0d2e2a
Correct case of $PSHOME special variable
xtqqczze Jan 13, 2020
427d17e
Correct case of $PSUICulture special variable
xtqqczze Jan 13, 2020
090ad9c
Correct case of $PSVersionTable special variable
xtqqczze Jan 13, 2020
a454352
Fix false positives
xtqqczze Jan 13, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function Start-PSBuild {
[switch]$Detailed
)

if ($PsCmdlet.ParameterSetName -eq "Default" -and !$NoPSModuleRestore)
if ($PSCmdlet.ParameterSetName -eq "Default" -and !$NoPSModuleRestore)
{
$PSModuleRestore = $true
}
Expand Down Expand Up @@ -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)"

Expand All @@ -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 {
Expand Down Expand Up @@ -498,7 +498,7 @@ Fix steps:
$psVersion = $ReleaseTag
}
else {
$psVersion = git --git-dir="$PSSCriptRoot/.git" describe
$psVersion = git --git-dir="$PSScriptRoot/.git" describe
}

if ($Environment.IsRedHatFamily -or $Environment.IsDebian) {
Expand Down Expand Up @@ -1393,19 +1393,19 @@ function Show-PSPesterError
[PSCustomObject]$testFailureObject
)

if ($PSCmdLet.ParameterSetName -eq 'xml')
if ($PSCmdlet.ParameterSetName -eq 'xml')
{
$description = $testFailure.description
$name = $testFailure.name
$message = $testFailure.failure.message
$stackTrace = $testFailure.failure."stack-trace"
$StackTrace = $testFailure.failure."stack-trace"
}
elseif ($PSCmdLet.ParameterSetName -eq 'object')
elseif ($PSCmdlet.ParameterSetName -eq 'object')
{
$description = $testFailureObject.Describe + '/' + $testFailureObject.Context
$name = $testFailureObject.Name
$message = $testFailureObject.FailureMessage
$stackTrace = $testFailureObject.StackTrace
$StackTrace = $testFailureObject.StackTrace
}
else
{
Expand All @@ -1417,7 +1417,7 @@ function Show-PSPesterError
Write-Log -Error "message:"
Write-Log -Error $message
Write-Log -Error "stack-trace:"
Write-Log -Error $stackTrace
Write-Log -Error $StackTrace

}

Expand Down Expand Up @@ -1455,14 +1455,14 @@ function Test-XUnitTestResults
$description = $failure.test.type
$name = $failure.test.method
$message = $failure.test.failure.message.'#cdata-section'
$stackTrace = $failure.test.failure.'stack-trace'.'#cdata-section'
$StackTrace = $failure.test.failure.'stack-trace'.'#cdata-section'

Write-Log -Error ("Description: " + $description)
Write-Log -Error ("Name: " + $name)
Write-Log -Error "message:"
Write-Log -Error $message
Write-Log -Error "stack-trace:"
Write-Log -Error $stackTrace
Write-Log -Error $StackTrace
}

throw "$($failedTests.failed) tests failed"
Expand All @@ -1488,7 +1488,7 @@ function Test-PSPesterResults
[switch] $CanHaveNoResult
)

if($PSCmdLet.ParameterSetName -eq 'file')
if($PSCmdlet.ParameterSetName -eq 'file')
{
if(!(Test-Path $TestResultsFile))
{
Expand All @@ -1515,7 +1515,7 @@ function Test-PSPesterResults
throw "$($x.'test-results'.failures) tests in $TestArea failed"
}
}
elseif ($PSCmdLet.ParameterSetName -eq 'PesterPassThruObject')
elseif ($PSCmdlet.ParameterSetName -eq 'PesterPassThruObject')
{
if ($ResultObject.TotalCount -le 0 -and -not $CanHaveNoResult)
{
Expand Down Expand Up @@ -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 }
}
}
Expand Down Expand Up @@ -2385,7 +2385,7 @@ function Copy-PSGalleryModules

$cache = dotnet nuget locals global-packages -l
if ($cache -match "info : global-packages: (.*)") {
$nugetCache = $matches[1]
$nugetCache = $Matches[1]
}
else {
throw "Can't find nuget global cache"
Expand All @@ -2400,7 +2400,7 @@ function Copy-PSGalleryModules

# Remove the build revision from the src (nuget drops it).
$srcVer = if ($version -match "(\d+.\d+.\d+).0") {
$matches[1]
$Matches[1]
} elseif ($version -match "^\d+.\d+$") {
# Two digit versions are stored as three digit versions
"$version.0"
Expand Down
4 changes: 2 additions & 2 deletions demos/crontab/CronTab/CronTab.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Invoke-CronTab ([String] $user, [String[]] $arguments, [Switch] $noThro

Write-Verbose "Running: $crontabcmd $arguments"
$output = & $crontabcmd @arguments 2>&1
if ($LastExitCode -ne 0 -and -not $noThrow) {
if ($LASTEXITCODE -ne 0 -and -not $noThrow) {
$e = New-Object System.InvalidOperationException -ArgumentList $output.Exception.Message
throw $e
} else {
Expand Down Expand Up @@ -125,7 +125,7 @@ function Remove-CronJob {
$e = New-Object System.Exception -ArgumentList "Job not found"
throw $e
}
if ($Force -or $pscmdlet.ShouldProcess($Job.Command,"Remove")) {
if ($Force -or $PSCmdlet.ShouldProcess($Job.Command,"Remove")) {
Import-CronTab -user $UserName -crontab $newcrontab
}
}
Expand Down
2 changes: 1 addition & 1 deletion demos/rest/rest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function Get-Issue
{
if ($link -match '\s*<(.*)>;\s+rel="next"')
{
$uri = $matches[1]
$uri = $Matches[1]
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions docker/tests/containerTestCommon.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function Get-LinuxContainer
{
Write-Output @{
Name = $os
Path = "$psscriptroot/../release/$os"
Path = "$PSScriptRoot/../release/$os"
}
}
}
Expand All @@ -84,7 +84,7 @@ function Get-WindowsContainer
{
Write-Output @{
Name = $os
Path = "$psscriptroot/../release/$os"
Path = "$PSScriptRoot/../release/$os"
}
}
}
Expand Down Expand Up @@ -183,7 +183,7 @@ function Get-ContainerPowerShellVersion
$runParams = @()
$localVolumeName = $testContext.resolvedTestDrive
$runParams += '--rm'
if($TestContext.Type -ne 'Windows' -and $isWindows)
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
# use a container volume on windows because host volumes are not automatic
$volumeName = "test-volume-" + (Get-Random -Minimum 100 -Maximum 999)
Expand All @@ -204,7 +204,7 @@ function Get-ContainerPowerShellVersion
$runParams += ('$PSVersionTable.PSVersion.ToString() | out-string | out-file -encoding ascii -FilePath '+$testContext.containerLogPath)

$null = Invoke-Docker -Command run -Params $runParams -SuppressHostOutput
if($TestContext.Type -ne 'Windows' -and $isWindows)
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
$null = Invoke-Docker -Command cp -Params "${volumeName}:$($testContext.containerLogPath)", $TestContext.ResolvedLogPath
$null = Invoke-Docker -Command container, rm -Params $volumeName, '--force' -SuppressHostOutput
Expand Down
8 changes: 4 additions & 4 deletions src/Modules/Windows/PSDiagnostics/PSDiagnostics.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,17 @@ function Enable-PSWSManCombinedTrace
$traceFileName = [string][Guid]::NewGuid()
if ($DoNotOverwriteExistingTrace) {
$fileName = [string][guid]::newguid()
$logfile = $pshome + "\\Traces\\PSTrace_$fileName.etl"
$logfile = $PSHOME + "\\Traces\\PSTrace_$fileName.etl"
} else {
$logfile = $pshome + "\\Traces\\PSTrace.etl"
$logfile = $PSHOME + "\\Traces\\PSTrace.etl"
}

"Microsoft-Windows-PowerShell 0 5" | out-file $provfile -encoding ascii
"Microsoft-Windows-WinRM 0 5" | out-file $provfile -encoding ascii -append

if (!(Test-Path $pshome\Traces))
if (!(Test-Path $PSHOME\Traces))
{
New-Item -ItemType Directory -Force $pshome\Traces | out-null
New-Item -ItemType Directory -Force $PSHOME\Traces | out-null
}

if (Test-Path $logfile)
Expand Down
12 changes: 6 additions & 6 deletions test/docker/networktest/DockerRemoting.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){

# capture the versions of full and core PowerShell
write-verbose -verbose "getting powershell full version"
$fullVersion = docker exec $client powershell -c "`$psversiontable.psversion.tostring()"
$fullVersion = docker exec $client powershell -c "`$PSVersionTable.psversion.tostring()"
if ( ! $fullVersion )
{
$pending = $true
Expand All @@ -50,7 +50,7 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){
}

write-verbose -verbose "getting powershell version"
$coreVersion = docker exec $client "$powershellcorepath" -c "`$psversiontable.psversion.tostring()"
$coreVersion = docker exec $client "$powershellcorepath" -c "`$PSVersionTable.psversion.tostring()"
if ( ! $coreVersion )
{
$pending = $true
Expand All @@ -68,22 +68,22 @@ Describe "Basic remoting test with docker" -tags @("Scenario","Slow"){
}

It "Full powershell can get correct remote powershell version" -pending:$pending {
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$PSVersionTable.psversion.tostring() }"
$result | Should -Be $coreVersion
}

It "Full powershell can get correct remote powershell full version" -pending:$pending {
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result = docker exec $client powershell -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$PSVersionTable.psversion.tostring() }"
$result | Should -Be $fullVersion
}

It "Core powershell can get correct remote powershell version" -pending:$pending {
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -configurationname $powershellcoreConfiguration -auth basic -credential `$c; invoke-command -session `$ses { `$PSVersionTable.psversion.tostring() }"
$result | Should -Be $coreVersion
}

It "Core powershell can get correct remote powershell full version" -pending:$pending {
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$psversiontable.psversion.tostring() }"
$result = docker exec $client "$powershellcorepath" -c "`$ss = [security.securestring]::new(); '11aa!!AA'.ToCharArray() | ForEach-Object { `$ss.appendchar(`$_)}; `$c = [pscredential]::new('testuser',`$ss); `$ses=new-pssession $serverhostname -auth basic -credential `$c; invoke-command -session `$ses { `$PSVersionTable.psversion.tostring() }"
$result | Should -Be $fullVersion
}
}
6 changes: 3 additions & 3 deletions test/packaging/windows/msi.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function Invoke-Msiexec {
[HashTable] $Properties

)
$action = "$($PsCmdlet.ParameterSetName)ing"
$action = "$($PSCmdlet.ParameterSetName)ing"
if ($Install.IsPresent) {
$switch = '/I'
} else {
Expand Down Expand Up @@ -70,10 +70,10 @@ Describe -Name "Windows MSI" -Fixture {
$uploadedLog = $false
}
BeforeEach {
$Error.Clear()
$error.Clear()
}
AfterEach {
if ($Error.Count -ne 0 -and !$uploadedLog) {
if ($error.Count -ne 0 -and !$uploadedLog) {
Copy-Item -Path $msiLog -Destination $env:temp -Force
Write-Verbose "MSI log is at $env:temp\msilog.txt" -Verbose
$uploadedLog = $true
Expand Down
2 changes: 1 addition & 1 deletion test/powershell/Host/Base-Directory.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Describe "Configuration file locations" -tags "CI","Slow" {

BeforeAll {
$powershell = Join-Path -Path $PsHome -ChildPath "pwsh"
$powershell = Join-Path -Path $PSHOME -ChildPath "pwsh"
$profileName = "Microsoft.PowerShell_profile.ps1"
}

Expand Down
Loading