Skip to content

Add pipefail to aws-mfa to exit on profile errors#106

Merged
ikuwow merged 1 commit intomainfrom
claude/xenodochial-chandrasekhar
Mar 20, 2026
Merged

Add pipefail to aws-mfa to exit on profile errors#106
ikuwow merged 1 commit intomainfrom
claude/xenodochial-chandrasekhar

Conversation

@ikuwow
Copy link
Copy Markdown
Owner

@ikuwow ikuwow commented Mar 20, 2026

Summary

  • Add pipefail option to bin/aws-mfa so the script exits immediately when
    aws sts get-caller-identity fails (e.g., "The config profile could not be found").

Why

The script pipes aws | jq | sed on line 51. Without pipefail, the
pipeline exit status comes from the last command (sed), which always
succeeds — masking the AWS CLI error and letting the script continue with
an invalid ARN.

Verification

  • shellcheck bin/aws-mfa passes with no warnings.
  • Ran aws-mfa -p nonexistent-profile-12345 and confirmed the script exits immediately with:
    Using `nonexistent-profile-12345` profile
    aws: [ERROR]: The config profile (nonexistent-profile-12345) could not be found
    Exit code: 255
    

Closes #31

Fixes #31

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@ikuwow ikuwow marked this pull request as ready for review March 20, 2026 08:24
@ikuwow ikuwow merged commit cc1bf7c into main Mar 20, 2026
4 checks passed
@ikuwow ikuwow deleted the claude/xenodochial-chandrasekhar branch March 20, 2026 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-mfa: The config profile could not be found が出たら強制終了されるようにする

1 participant