fabric/fabric — Issue #508: io - output_loop - _flush with parallel interlacing
Author: teichopsia
Created: 2011-12-18 13:55:59+00:00
State: open

this covers an issue when running a large output over a large cluster with high -Pz whereby the output of one command would get interrupted by another node due to how output was done via two writes instead of one per line and resemble:

========
[foo] out: [bar] out: baroutput
foooutput
========

changing the _flush call to work on a joined line+prefix resolves this.

I also made output filter sudo lines for subsequent calls as part of others hacks, so ignore that part of the diff if you like.

***************
*** 60,67 ****
if byte == '':
# If linewise, ensure we flush any leftovers in the buffer.
if linewise and line:
! _flush(pipe, _prefix)
! _flush(pipe, "".join(line))
break
# A None capture variable implies that we're in open_shell()
if capture is None:
--- 63,70 ----
if byte == '':
# If linewise, ensure we flush any leftovers in the buffer.
if linewise and line:
! if("".join(line) != env.sudo_prompt):
! _flush(pipe, _prefix+"".join(line))
break
# A None capture variable implies that we're in open_shell()
if capture is None:
***************
*** 80,87 ****
if linewise:
# Print prefix + line after newline is seen
if _was_newline(_buffer, byte):
! _flush(pipe, _prefix)
! _flush(pipe, "".join(line))
line = []
# Add to line buffer
line += byte
--- 83,90 ----
if linewise:
# Print prefix + line after newline is seen
if _was_newline(_buffer, byte):
! if("".join(line) != env.sudo_prompt):
! _flush(pipe, _prefix+"".join(line))
line = []
# Add to line buffer
line += byte