Unexpected 0 return code from `echo "" | gcloud auth application-default print-access-token` when unauthenticated
Closed this issue · 2 comments
jamesbraza commented
I am trying to suppress the password prompt for gcloud auth application-default print-access-token
. When piping echo ""
into that command, I expect:
- The password prompt to be suppressed
- A nonzero return code, as the authentication failed (empty password)
In actuality, it suppresses the password prompt, but it gives a 0 return code. I think this is a bug, it should have a nonzero return code because it's a failed authentication.
> gcloud auth application-default print-access-token
Reauthentication required.
Please enter your password:
Command killed by keyboard interrupt
> echo $?
130
> echo "" | gcloud auth application-default print-access-token
> echo $?
0
I have the below version on macOS Sonoma version 14.3:
> gcloud --version
Google Cloud SDK 468.0.0
bq 2.0.101
core 2024.03.08
gcloud-crc32c 1.0.0
gsutil 5.27
twistedpair commented
This is a mirror repo. It is not the location for reporting gcloud bugs.
To report gcloud bugs, please see the official bug tracker.
jamesbraza commented
Thank you @twistedpair sorry for opening this in the wrong place. I have made https://issuetracker.google.com/issues/355182139