def adb_pushfile(adb, filepath, remote_path):
filesize = os.path.getsize(filepath)
pb = tqdm.tqdm(unit='B', unit_scale=True, total=filesize)
p = adb.raw_cmd('push', filepath, remote_path)
while True:
try:
p.wait(0.5)
except subprocess.TimeoutExpired:
pb.n = get_file_size(adb, remote_path)
pb.refresh()
# log.info("Progress %dM/%dM", get_file_size(remote_path) >>20, filesize >>20)
pass
except (KeyboardInterrupt, SystemExit):
p.kill()
raise
except:
raise
else:
# log.info("Success pushed into device")
break
pb.close()
评论列表
文章目录