Skip to content

Commit

Permalink
fix help function to not pipe to more if objects are returned inste…
Browse files Browse the repository at this point in the history
…ad of help text (PowerShell#5395)
  • Loading branch information
SteveL-MSFT authored and adityapatwardhan committed Nov 10, 2017
1 parent 8b42e17 commit e0ee555
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/System.Management.Automation/engine/InitialSessionState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4258,10 +4258,20 @@ .FORWARDHELPCATEGORY Cmdlet
$PSBoundParameters['Full'] = $true
}
#Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
# Set the outputencoding to Console::OutputEncoding. More.com doesn't work well with Unicode.
$outputEncoding=[System.Console]::OutputEncoding
Get-Help @PSBoundParameters | more
$help = Get-Help @PSBoundParameters
# If a list of help is returned, don't pipe to more
if (($help | Select-Object -First 1).PSTypeNames -Contains 'HelpInfoShort')
{
$help
}
else
{
$help | more
}
";
}

Expand Down

0 comments on commit e0ee555

Please sign in to comment.