Skip to content

Pager preference is not obeyed on Windows #8351

Closed
@jimbo8098

Description

@jimbo8098

Describe the bug

The AWS_PAGER environment variable or cli_pager config file parameter is not obeyed specifically if you wish to disable pagination. It is obeyed if you set it to a paginator of your choice.

Expected Behavior

Per the AWS CLI documentation you can set the AWS_PAGER environment variable to be a blank string (i.e. not $null) or you can set the relevant option in config like so:

cli_pager=

Both of these would not result in paginated output.

Current Behavior

> $Env:AWS_PAGER=$null
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'more' is not recognized as an internal or external command,
operable program or batch file.
> $Env:AWS_PAGER="less"
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'less' is not recognized as an internal or external command,
operable program or batch file.
> $Env:AWS_PAGER=""
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'more' is not recognized as an internal or external command,
operable program or batch file.
> [System.Environment]::SetEnvironmentVariable("AWS_PAGER","")
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'more' is not recognized as an internal or external command,
operable program or batch file.
> [System.Environment]::SetEnvironmentVariable("AWS_PAGER","less")
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'less' is not recognized as an internal or external command,
operable program or batch file.
> [System.Environment]::SetEnvironmentVariable("AWS_PAGER",$null)
> aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json
'more' is not recognized as an internal or external command,
operable program or batch file.

Note that if I instead run the AWS CLI command with --no-cli-pager, like below, the command works as expected:

aws ec2 describe-instances --filters "Name=tag:Name,Values=Workstation" --query Reservations[].Instances[] --output json --no-cli-pager

Reproduction Steps

  1. Set ~/.aws/config's default profile to have cli_pager=
  2. Open a new PowerShell Window
  3. Run [System.Environment]::SetEnvironmentVariable("AWS_PAGER","")
  4. Assume your AWS profile of choice. I used an existing SSO session by setting $Env:AWS_PROFILE to the relevant profile name.
  5. Run a CLI paginated AWS CLI command, such as the describe-instances command above. The output is be paginated.

Possible Solution

I use both Windows and Linux and haven't seen this same behaviour exhibited by Linux. I therefore suspect that this is just an oversight in how Windows handles variables.

Additional Information/Context

  • I don't set any AWS environment variables in my $PROFILE
  • I am using aws-cli/2.13.25 Python/3.11.5 Windows/10 exe/AMD64 prompt/off
  • I am using Powershell version 7.3.9

CLI version used

aws-cli/2.13.25 Python/3.11.5 Windows/10 exe/AMD64 prompt/off

Environment details (OS name and version, etc.)

Windows 10 Business 10.0.19045

Metadata

Metadata

Labels

bugThis issue is a bug.p2This is a standard priority issuepagerissues related to AWS_PAGER, cli_pager, or other client-side paging (not API pagination)response-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.windows

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions