Fabric为Git进度的每一点都打印了一条新线

时间:2013-09-09 22:47:15

标签: fabric

我在远程计算机上将Fabric设置为git fetch。它运行正常,但是对于Git打印的每个百分比进度,都会在stdout上打印一个新行:

[host] out: remote: Compressing objects:   1% (3/252)   
[host] out: remote: Compressing objects:   2% (6/252)   
[host] out: remote: Compressing objects:   3% (8/252)   
[host] out: remote: Compressing objects:   4% (11/252)   
[host] out: remote: Compressing objects:   5% (13/252)   
[host] out: remote: Compressing objects:   6% (16/252)   
[host] out: remote: Compressing objects:   7% (18/252)   
[host] out: remote: Compressing objects:   8% (21/252)   
[host] out: remote: Compressing objects:   9% (23/252) 
...
[host] out: Resolving deltas:   0% (0/72)   
[host] out: Resolving deltas:  12% (9/72)   
[host] out: Resolving deltas:  15% (11/72)   
[host] out: Resolving deltas:  18% (13/72)   
[host] out: Resolving deltas:  22% (16/72)   
[host] out: Resolving deltas:  23% (17/72)   
[host] out: Resolving deltas:  55% (40/72)  

如何防止这种情况发生?

2 个答案:

答案 0 :(得分:8)

试试这个:

run('git fetch', pty=False)

答案 1 :(得分:1)

如果我不想看到命令的输出,我通常会这样做:

with hide('stdout'):
    run('git fetch')