joaojacome/bitwarden-ssh-agent

Login check via subprocess not working as intended with bw 2023.1.0

cargocultprogramming opened this issue · 1 comments

The login check in line 71 of bw_add_sshkeys.py has set check=True:

proc_logged = subprocess.run(["bw", "login", "--check", "--quiet"], check=True)

However the latest linux bw cli client (version 2023.1.0) returns a non-zero error code for that call if you are not already logged in, which results in subprocess raising an exception due to check=True. That exception is caught in main (line 312) and results in termination, without ever trying to log in.

[ I'm not logged in ]
$ bw login --check --quiet
$ echo $?
1

Setting check=False for subprocess.run() let's the script run as intended. Not sure if there are any other errors this tends to catch, so I'm not submitting a pull request. On my box it works, when I set check=False for that call.

ACK

I'll take a look at this during the weekend. Thanks for the report.