Skip to content

Auto-prompt mode breaks non-interactive aws usage #8330

Open
@joehorsnell

Description

@joehorsnell

Describe the bug

Enabling the auto-prompt feature, eg using AWS_CLI_AUTO_PROMPT=on, breaks non-interactive use of aws, such as invoking from a script.

A couple of related issues, #5317 and #7862, have comments suggesting the use of on-partial, eg using AWS_CLI_AUTO_PROMPT=on-partial, but this is really a workaround.

The AWS CLI should check if it's being invoked interactively, eg checking for a tty, and conditionally disable auto-prompt mode, as you should only ever want that behaviour when running interactively.

Expected Behavior

aws should work correctly non-interactively (eg when invoked from a script) by disabling auto-prompt mode if it's on.

Current Behavior

aws displays the auto-prompt when invoked non-interactively, eg from a script, rather than running the desired command, breaking the script.

Reproduction Steps

Enable auto-prompt mode, using export AWS_CLI_AUTO_PROMPT=on and run any aws command from a script.

Possible Solution

As per description, check for a tty.

Additional Information/Context

No response

CLI version used

aws-cli/2.13.35 Python/3.11.6 Darwin/21.6.0 exe/x86_64

Environment details (OS name and version, etc.)

macOS Monterey 12.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    auto-prompt-modeIssues related to CLI auto-prompt modebugThis issue is a bug.needs-reviewThis issue or pull request needs review from a core team member.p3This is a minor priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions