mc-agent icon indicating copy to clipboard operation
mc-agent copied to clipboard

"mc-agent cli -c list" should not return exit code 0 on error

Open asashnov opened this issue 7 years ago • 1 comments

"mc-agent cli -c list" should not return exit code 0 on error

Currently mc-agent cli -c list always returns exit code 0, even there is some error, so Mooltipass GUI, SSH Keys tab can't distinct empty list of keys from any error occured.

Actual result:

$ mc-agent cli -c list
[]
$ echo $?
0

Now exit code is always 0 no matter what:

  • Mooltipass device is not connected
  • Security card is not inserted
  • Mooltipass is locked
  • Getting "moolticute ssh keys" wasn't confirmed

Expected result:

Exit code should be non-zero in a case of any error. Moolticute GUI, "SSH Keys" tab should show an error if SSH Keys was not loaded from a device.

Only absence of "moolticute ssh keys" file is a normal situation and exit code should be 0 if there is no such file on a Mooltipass device (mc-agent wasn't used yet).

asashnov avatar Dec 18 '18 13:12 asashnov

I did some testing (with a Mini BLE), and apparently only the last case Getting "moolticute ssh keys" wasn't confirmed is indistinguishable from the missing file.

The other cases send a mp_disconnected or status_changed message and could be better handled to return some other exit code (I have a prototype here: https://git.sr.ht/~oliverpool/go-moolticute/tree/main/item/client.go)

oliverpool avatar Nov 30 '21 09:11 oliverpool