terminus
terminus copied to clipboard
`terminus whoami` no longer exits with return code 1 when unauthenticated
In terminus 0.x, terminus whoami would exit with return code 1 when unauthenticated.
In terminus 1.x, terminus whoami exits with return code 0 when unauthenticated.
As a terminus user, it's easier to use terminus whoami in scripts when its return codes reflect authentication state.
Related https://github.com/lcache/wp-lcache/issues/119
Added to our Jira queue as AL-1038
How much longer do we have to wait for this simple fix? The auth:whoami command needs to exit with a 0 if the user is authenticated, and 1 if the user is not authenticated. This used to work in Terminus 0.13.x, and now it's broken in Terminus 1.x.
There are a lot of Terminus issues; this one probably just got forgotten. I created a PR to kick things off again.
Awesome! Thanks Greg. PR #1926 looks good to me. I tested it by patching locally, and it works as expected. I appreciate the quick response.
This issue seems to be present in Terminus 3 also.
The breaking change here happened between 0.x and 1.x, at this point the current behavior of 4.x is to exit with a notice instead of an error. If we're going to do this, it is no longer a bug fix and will be a breaking change held for Terminus 5.
I disagree with the comment in the linked (now closed) PR "not being logged in is not an erroneous state" as we're discussing here adding a non-zero exit. If we're going to exit with an error code according to shell semantics, it's an error state and throwing an exception with an error message as Greg proposed is just fine.