X Tutup
The Wayback Machine - https://web.archive.org/web/20240518081118/https://github.com/PowerShell/PowerShell/issues/6142
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid handling of the PAGER environment variable #6142

Closed
kevinboulain opened this issue Feb 9, 2018 · 0 comments · Fixed by #6144
Closed

Invalid handling of the PAGER environment variable #6142

kevinboulain opened this issue Feb 9, 2018 · 0 comments · Fixed by #6144
Assignees
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.

Comments

@kevinboulain
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Issue has been identified as a bug in the product Resolution-Fixed The issue is fixed.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
X Tutup