terminus icon indicating copy to clipboard operation
terminus copied to clipboard

`terminus whoami` no longer exits with return code 1 when unauthenticated

Open danielbachhuber opened this issue 8 years ago • 5 comments
trafficstars

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

danielbachhuber avatar May 03 '17 21:05 danielbachhuber

Added to our Jira queue as AL-1038

TeslaDethray avatar May 05 '17 17:05 TeslaDethray

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.

kzalewski avatar Jan 11 '19 05:01 kzalewski

There are a lot of Terminus issues; this one probably just got forgotten. I created a PR to kick things off again.

greg-1-anderson avatar Jan 11 '19 06:01 greg-1-anderson

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.

kzalewski avatar Jan 12 '19 05:01 kzalewski

This issue seems to be present in Terminus 3 also.

stevector avatar Feb 22 '25 00:02 stevector

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.

pwtyler avatar Sep 25 '25 00:09 pwtyler