From 5865912d3ce1859092143807513927ea302cf81a Mon Sep 17 00:00:00 2001
From: Alexandre Iooss <erdnaxe@crans.org>
Date: Thu, 7 May 2020 17:26:11 +0200
Subject: [PATCH] Fix edit password return

---
 cpasswords/client.py | 9 +++------
 cpasswords/remote.py | 4 ++++
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/cpasswords/client.py b/cpasswords/client.py
index 5bccfd0..c615e83 100755
--- a/cpasswords/client.py
+++ b/cpasswords/client.py
@@ -253,7 +253,8 @@ def put_password(options, roles, contents):
     success, enc_pwd_or_error = my_encrypt(options, roles, contents)
     if success:
         enc_pwd = enc_pwd_or_error
-        return put_files(options, [{'filename': options.filename, 'roles': roles, 'contents': enc_pwd}])[0]
+        put_files(options, [{'filename': options.filename, 'roles': roles, 'contents': enc_pwd}])
+        return [True, ""]
     else:
         error = enc_pwd_or_error
         return [False, error]
@@ -638,11 +639,7 @@ def recrypt_files(options, strict=False):
         if not options.quiet:
             print("Rechiffrement de %s" %
                   (", ".join([f['filename'] for f in to_put])))
-        results = put_files(options, to_put)
-        # On affiche les messages de retour
-        if not options.quiet:
-            for i in range(len(results)):
-                print("%s : %s" % (to_put[i]['filename'], results[i][1]))
+        put_files(options, to_put)
     else:
         log.warn(_("Aucun fichier n'a besoin d'être rechiffré"))
 
diff --git a/cpasswords/remote.py b/cpasswords/remote.py
index 580cd1f..f3e1f20 100644
--- a/cpasswords/remote.py
+++ b/cpasswords/remote.py
@@ -65,6 +65,10 @@ def remote_command(options, command, arg=None, stdin_contents=None):
         stdin.write(json.dumps(stdin_contents))
         stdin.flush()
 
+    # If the server is not expected to exit, then exit now
+    if stdin_contents:
+        return
+
     # Return code == 0 if success
     ret = stdout.channel.recv_exit_status()
     if ret != 0:
-- 
GitLab