cmd_receive: close the file before renaming

I'm always forgetting this one. It's more obvious on windows.
This commit is contained in:
Brian Warner 2016-02-27 17:20:43 -08:00
parent f28f294138
commit 8067acbf82

View File

@ -153,6 +153,7 @@ def receive_blocking(args):
assert received == xfersize assert received == xfersize
if mode == "file": if mode == "file":
f.close()
os.rename(tmp_destname, abs_destname) os.rename(tmp_destname, abs_destname)
print(u"Received file written to %s" % destname, file=args.stdout) print(u"Received file written to %s" % destname, file=args.stdout)
else: else:
@ -164,6 +165,7 @@ def receive_blocking(args):
# "../tmp/oops" both do the same thing as the (safe) # "../tmp/oops" both do the same thing as the (safe)
# "tmp/oops". # "tmp/oops".
print(u"Received files written to %s/" % destname, file=args.stdout) print(u"Received files written to %s/" % destname, file=args.stdout)
f.close()
record_pipe.send_record(b"ok\n") record_pipe.send_record(b"ok\n")
record_pipe.close() record_pipe.close()