mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Resolve :PAGER' if its path contains spaces (#8571)
This commit is contained in:
committed by
Aditya Patwardhan
parent
f03cafbdd8
commit
4858afb613
@@ -513,3 +513,34 @@ Describe "Help failure cases" -Tags Feature {
|
||||
{ & $command foobar -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand"
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'help renders when using a PAGER with a space in the path' -Tags 'CI' {
|
||||
BeforeAll {
|
||||
$fakePager = @'
|
||||
param(
|
||||
[Parameter]
|
||||
$customCommandArgs,
|
||||
|
||||
[Parameter(ValueFromPipelineByPropertyName)]
|
||||
$Name
|
||||
)
|
||||
|
||||
$b = [System.Text.Encoding]::UTF8.GetBytes($Name)
|
||||
return [System.Convert]::ToBase64String($b)
|
||||
'@
|
||||
$fakePagerFolder = Join-Path $TestDrive "path with space"
|
||||
$fakePagerPath = Join-Path $fakePagerFolder "fakepager.ps1"
|
||||
New-Item -ItemType File -Path $fakePagerPath -Force > $null
|
||||
Set-Content -Path $fakePagerPath -Value $fakePager
|
||||
|
||||
$SavedEnvPager = $env:PAGER
|
||||
$env:PAGER = $fakePagerPath
|
||||
}
|
||||
AfterAll {
|
||||
$env:PAGER = $SavedEnvPager
|
||||
}
|
||||
|
||||
It 'help renders when using a PAGER with a space in the path' {
|
||||
help Get-Command | Should -Be "R2V0LUNvbW1hbmQ="
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user