Mercurial > hg > python
changeset 41:900ff99ec749
less noisy if success
author | Henry S. Thompson <ht@inf.ed.ac.uk> |
---|---|
date | Mon, 03 Jan 2022 19:26:11 +0000 |
parents | f13017bb4502 |
children | 59517f60826d |
files | newkey.py |
diffstat | 1 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/newkey.py Mon Jan 03 19:19:20 2022 +0000 +++ b/newkey.py Mon Jan 03 19:26:11 2022 +0000 @@ -12,15 +12,21 @@ import sys, os from socket import gethostname -from subprocess import run +from subprocess import run, PIPE hack=os.environ.copy() hack['SSH_AUTH_SOCK']='/home/ht/.gnupg/S.gpg-agent.ssh' def ssh_copy_id(keyfile,client): print(["ssh-copy-id","-i",keyfile,client],'...',sep='',end='') - res=run(["ssh-copy-id","-i",keyfile,client],env=hack).returncode - print('failed %s'%res if res else 'succeeded') + res=run(["ssh-copy-id","-i",keyfile,client],env=hack,text=True, + stdout=PIPE,stderr=PIPE) + if res.returncode: + print('failed %s'%res.returncode) + outs,errs=res.communicate() + print(errs) + else: + print('succeeded') ihost=None if sys.argv[1]=='-v':