Skip to content

Commit a4c9d33

Browse files
author
Paul Sokolovsky
committed
webrepl_cli.py: put_file(): Show transfer progress.
As it's pretty slow for large files, that's really helpful.
1 parent b6fb3dc commit a4c9d33

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

webrepl_cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,12 +109,17 @@ def put_file(ws, local_file, remote_file):
109109
ws.write(rec[:10])
110110
ws.write(rec[10:])
111111
assert read_resp(ws) == 0
112+
cnt = 0
112113
with open(local_file, "rb") as f:
113114
while True:
115+
sys.stdout.write("Sent %d of %d bytes\r" % (cnt, sz))
116+
sys.stdout.flush()
114117
buf = f.read(1024)
115118
if not buf:
116119
break
117120
ws.write(buf)
121+
cnt += len(buf)
122+
print()
118123
assert read_resp(ws) == 0
119124

120125
def get_file(ws, local_file, remote_file):

0 commit comments

Comments
 (0)