Help
function should only pass content to pager if content was found (#8528)
This commit is contained in:
parent
031cbf0f16
commit
64fcddcb53
|
@ -4157,7 +4157,7 @@ param(
|
|||
{
|
||||
$help
|
||||
}
|
||||
else
|
||||
elseif ($help -ne $null)
|
||||
{
|
||||
# Respect PAGER, use more on Windows, and use less on Linux
|
||||
$moreCommand,$moreArgs = $env:PAGER -split '\s+'
|
||||
|
|
|
@ -477,3 +477,14 @@ Describe 'help can be found for AllUsers Scope' -Tags @('Feature', 'RequireAdmin
|
|||
$helpObj.description | Out-String | Should -Match $CmdletName
|
||||
}
|
||||
}
|
||||
|
||||
Describe "Help failure cases" -Tags Feature {
|
||||
It "An error is returned for a topic that doesn't exist: <command>" -TestCases @(
|
||||
@{ command = "help" },
|
||||
@{ command = "get-help" }
|
||||
){
|
||||
param($command)
|
||||
|
||||
{ & $command foobar -ErrorAction Stop } | Should -Throw -ErrorId "HelpNotFound,Microsoft.PowerShell.Commands.GetHelpCommand"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue