From e186367d5dc82c93ac99762411e63d1e8db374ed Mon Sep 17 00:00:00 2001 From: Ymage Date: Sun, 21 Aug 2022 13:11:20 +0200 Subject: [PATCH] Fix for already set SSH_ASKPASS env var --- bw_add_sshkeys.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bw_add_sshkeys.py b/bw_add_sshkeys.py index 6aa8009..3c502ce 100755 --- a/bw_add_sshkeys.py +++ b/bw_add_sshkeys.py @@ -226,7 +226,7 @@ def ssh_add(session: str, item_id: str, key_id: str, key_pw: Optional[str]) -> N ) else: envdict = dict(os.environ, SSH_ASKPASS_REQUIRE="never") - + logging.debug("Running ssh-add") # CAVEAT: `ssh-add` provides no useful output, even with maximum verbosity subprocess.run( @@ -236,7 +236,7 @@ def ssh_add(session: str, item_id: str, key_id: str, key_pw: Optional[str]) -> N env=envdict, universal_newlines=True, check=True, - ) + ) if __name__ == '__main__': @@ -305,7 +305,7 @@ def main() -> None: logging.error('"%s" error: %s', error.cmd[0], error.stderr) logging.debug('Error running %s', error.cmd) - if os.environ.get('SSH_ASKPASS'): + if os.environ.get('SSH_ASKPASS') and os.environ.get('SSH_ASKPASS') == os.path.realpath(__file__): print(os.environ.get('SSH_KEY_PASSPHRASE')) else: main()