nicer output
This commit is contained in:
@@ -122,14 +122,18 @@ def start_sync(options):
|
||||
command.extend([SRC,TGT])
|
||||
popen = subprocess.Popen(command,
|
||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE, bufsize=8)
|
||||
lines_iterator = iter(popen.stdout.readline, b"")
|
||||
j=0
|
||||
j=1
|
||||
try:
|
||||
for line in lines_iterator:
|
||||
sys.stdout.write(line)
|
||||
line=popen.stdout.read(8)
|
||||
while line:
|
||||
if '\n' in line:
|
||||
j+=1
|
||||
if j%100==0:
|
||||
print("#%d %s -> %s"%(i+1,SRC,TGT))
|
||||
if j%50==0:
|
||||
line=line.replace("\n","\n#%d %s -> %s\n"%(i+1,SRC,TGT),1)
|
||||
j=1
|
||||
sys.stdout.write(line)
|
||||
sys.stdout.flush()
|
||||
line=popen.stdout.read(8)
|
||||
except KeyboardInterrupt:
|
||||
popen.kill()
|
||||
sys.exit(1)
|
||||
|
||||
Reference in New Issue
Block a user