Revision 121f3bc0 image_creator/rsync.py
b/image_creator/rsync.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
2 |
# |
|
1 | 3 |
# Copyright 2012 GRNET S.A. All rights reserved. |
2 | 4 |
# |
3 | 5 |
# Redistribution and use in source and binary forms, with or |
... | ... | |
31 | 33 |
# interpreted as representing official policies, either expressed |
32 | 34 |
# or implied, of GRNET S.A. |
33 | 35 |
|
36 |
"""This module provides an interface for the rsync utility""" |
|
37 |
|
|
34 | 38 |
import subprocess |
35 | 39 |
import time |
36 | 40 |
import signal |
... | ... | |
98 | 102 |
stdout=subprocess.PIPE, bufsize=0) |
99 | 103 |
try: |
100 | 104 |
total = 0 |
101 |
for line in iter(dry_run.stdout.readline, b''):
|
|
105 |
for _ in iter(dry_run.stdout.readline, b''):
|
|
102 | 106 |
total += 1 |
103 | 107 |
finally: |
104 | 108 |
dry_run.communicate() |
... | ... | |
113 | 117 |
try: |
114 | 118 |
t = time.time() |
115 | 119 |
i = 0 |
116 |
for line in iter(run.stdout.readline, b''):
|
|
120 |
for _ in iter(run.stdout.readline, b''):
|
|
117 | 121 |
i += 1 |
118 | 122 |
current = time.time() |
119 | 123 |
if current - t > 0.1: |
Also available in: Unified diff