7

git fetch我已经在远程机器上设置了 Fabric 。它工作正常,但是对于stdoutGit 打印的每个百分比进度都会打印一个新行:

[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)  

我怎样才能防止这种情况发生?

4

2 回答 2

8

尝试这个:

run('git fetch', pty=False)
于 2013-09-10T16:29:26.537 回答
1

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

with hide('stdout'):
    run('git fetch')
于 2014-08-12T05:00:22.580 回答