我在远程计算机上将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)
如何防止这种情况发生?
答案 0 :(得分:8)
试试这个:
run('git fetch', pty=False)
答案 1 :(得分:1)
如果我不想看到命令的输出,我通常会这样做:
with hide('stdout'):
run('git fetch')