Skip to content

""ERROR Not logged in" not caught, not "OK" status in loop #3

@mabahj

Description

@mabahj

entrypoint.sh checks "$(jotta-cli status)" =~ ERROR.* to determine if the user is logged in. This does not catch the error output, since this is sent to stderr, not stdout. This was probably changed recently.

jotta-cli status seems to give exit code 0 if it fails, so a more robust version could be

jotta-cli status >/dev/null 2>&1
if [ $? -ne 0 ]; then
  echo "First time login"

Or, to keep the same solution:

if [[ "$(jotta-cli status 2>&1)" =~ ERROR.* ]];
  echo "First time login"

The same problem exists at cliout=$(jotta-cli status | tail -1). It is easy to verify by running jotta-cli status | grep -c OK, which returns "OK" and "0". jotta-cli status 2>&1 | grep -c OK returns 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions