mirror of
https://github.com/Rudd-O/ansible-qubes.git
synced 2025-06-06 18:08:31 +02:00
Fix incomplete read from the remote side.
This commit is contained in:
parent
3ad3761f2f
commit
6918df4f62
@ -138,16 +138,20 @@ def put(out_path):
|
|||||||
chunksize = int(sys.stdin.readline(16))
|
chunksize = int(sys.stdin.readline(16))
|
||||||
if chunksize == 0:
|
if chunksize == 0:
|
||||||
break
|
break
|
||||||
chunk = sys.stdin.read(chunksize)
|
while True:
|
||||||
assert len(chunk) == chunksize, ("Mismatch in chunk length", len(chunk), chunksize)
|
chunk = sys.stdin.read(chunksize)
|
||||||
try:
|
if chunk == b"":
|
||||||
f.write(chunk)
|
assert chunksize == 0, "Never could finish reading the last %s bytes" % chunksize
|
||||||
sys.stdout.write(b'Y\n')
|
break
|
||||||
except (IOError, OSError) as e:
|
try:
|
||||||
sys.stdout.write(b'N\n')
|
f.write(chunk)
|
||||||
encode_exception(e, sys.stdout)
|
except (IOError, OSError) as e:
|
||||||
f.close()
|
sys.stdout.write(b'N\n')
|
||||||
return
|
encode_exception(e, sys.stdout)
|
||||||
|
f.close()
|
||||||
|
return
|
||||||
|
chunksize = chunksize - len(chunk)
|
||||||
|
sys.stdout.write(b'Y\n')
|
||||||
try:
|
try:
|
||||||
f.flush()
|
f.flush()
|
||||||
except (IOError, OSError) as e:
|
except (IOError, OSError) as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user