Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Invalid handling of the PAGER environment variable #6142

Copy link
Copy link
@kevinboulain

Description

@kevinboulain
Issue body actions

Hi there,

I'm new to PowerShell and wanted to try it out but it quickly failed when I tried to use Get-Help.
I think this is related to #798 but I actually don't have any clue on how to fix so please bear with me (well, it looks like | pwsh -c "$env:PAGER" could work but that seems too awful to be the proper solution) :)

Steps to reproduce

> $env:PAGER
less -r

Expected behavior

I would have expected the behavior could conform to http://pubs.opengroup.org/onlinepubs/9699919799/utilities/man.html:

ENVIRONMENT VARIABLES
  PAGER
    Determine an output filtering command for writing the output to a terminal.
    Any string acceptable as a command_string operand to the sh -c command shall be valid.
    When standard output is a terminal device, the reference page output shall be piped through the command.
    If the PAGER variable is null or not set, the command shall be either more or another paginator utility documented in the system documentation.

Actual behavior

> help help
Get-Command : The term 'less -r' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:12 char:21
+ ... oreCommand = (Get-Command -CommandType Application $env:PAGER | Selec ...
+                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : ObjectNotFound: (less -r:String) [Get-Command], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException,Microsoft.PowerShell.Commands.GetCommandCommand

The expression after '&' in a pipeline element produced an object that was not valid. It must result in a command name, a script block, or a CommandInfo object.
At line:23 char:21
+ } else { $input | & $moreCommand }
+                     ~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : BadExpression

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.1
PSEdition                      Core
GitCommitId                    v6.0.1
OS                             Linux 4.14.0-3-amd64 #1 SMP Debian 4.14.12-2 (2018-01-06)
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Regards.

Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

Issue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productResolution-FixedThe issue is fixed.The issue is fixed.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.