From cd0df3cccf28fa1f54bc19e722182c7d26672e8b Mon Sep 17 00:00:00 2001 From: "Manuel Amador (Rudd-O)" Date: Sun, 21 Aug 2022 01:32:34 +0000 Subject: [PATCH] Tag 0.0.13. --- ansible-qubes.spec | 2 +- connection_plugins/qubes.py | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/ansible-qubes.spec b/ansible-qubes.spec index 9149155..e1868cb 100644 --- a/ansible-qubes.spec +++ b/ansible-qubes.spec @@ -3,7 +3,7 @@ %define mybuildnumber %{?build_number}%{?!build_number:1} Name: ansible-qubes -Version: 0.0.12 +Version: 0.0.13 Release: %{mybuildnumber}%{?dist} Summary: Inter-VM program execution for Qubes OS AppVMs and StandaloneVMs BuildArch: noarch diff --git a/connection_plugins/qubes.py b/connection_plugins/qubes.py index 70bb8b7..66531fa 100644 --- a/connection_plugins/qubes.py +++ b/connection_plugins/qubes.py @@ -138,20 +138,16 @@ def put(out_path): chunksize = int(sys.stdin.readline(16)) if chunksize == 0: break - while True: - chunk = sys.stdin.read(chunksize) - if chunk == b"": - assert chunksize == 0, "Never could finish reading the last %s bytes" % chunksize - break - try: - f.write(chunk) - except (IOError, OSError) as e: - sys.stdout.write(b'N\n') - encode_exception(e, sys.stdout) - f.close() - return - chunksize = chunksize - len(chunk) - sys.stdout.write(b'Y\n') + chunk = sys.stdin.read(chunksize) + assert len(chunk) == chunksize, ("Mismatch in chunk length", len(chunk), chunksize) + try: + f.write(chunk) + sys.stdout.write(b'Y\n') + except (IOError, OSError) as e: + sys.stdout.write(b'N\n') + encode_exception(e, sys.stdout) + f.close() + return try: f.flush() except (IOError, OSError) as e: