I need to read the status ( Receiving objects XXX%) of a git clone process, but can't figure out how.
I am using subprocess.Popen but I cant' figure out how to grab the line I need:
proc = subprocess.Popen([GIT, "-C",IDIR+"/"+REPO,"clone",URL],shell=False,bufsize=0,stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
This is the typical output:
Cloning into 'xxx'...
remote: Reusing existing pack: 5250, done.
remote: Counting objects: 1652, done.
remote: Compressing objects: 100% (1428/1428), done.
remote: Total 6902 (delta 389), reused 0 (delta 0)
Receiving objects: XXX% (6902/6902), 27.66 MiB | 1.51 MiB/s, done.
Resolving deltas: 100% (2010/2010), done.
Checking connectivity... done.
Checking out files: 100% (3266/3266), done.
Edit
I have tried all of the suggestions both in this thread and in the one suggested as a duplicate, but none appear to work.
This suggestion results in "Cloning into 'test'... done" but none of the other output:
popen = subprocess.Popen(["git", "clone", "https://github.com/xxx/test.git"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT,shell=False )
for line in popen.stdout:
print "out newline:"
print line
print "done"
This is the output which does not contain any of the stats:
out newline:
Cloning into 'test'...
done