mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-04 08:24:40 +01:00
tee fix for pipelines
This commit is contained in:
parent
2428e445fc
commit
448c268758
2 changed files with 8 additions and 2 deletions
|
@ -9,6 +9,8 @@
|
|||
**Fixed:**
|
||||
|
||||
* Standard stream tees have been fixed to accept the possibility that
|
||||
they may not be backed by a binary buffer.
|
||||
they may not be backed by a binary buffer. This inludes the pipeline
|
||||
stdout tee as well as the shell tees.
|
||||
|
||||
|
||||
**Security:** None
|
||||
|
|
|
@ -1509,10 +1509,14 @@ class CommandPipeline:
|
|||
err = env.get('XONSH_ENCODING_ERRORS')
|
||||
lines = self.lines
|
||||
stream = self.captured not in STDOUT_CAPTURE_KINDS
|
||||
sydout_has_buffer = hasattr(sys.stdout, 'buffer')
|
||||
for line in self.iterraw():
|
||||
# write to stdout line ASAP, if needed
|
||||
if stream:
|
||||
sys.stdout.buffer.write(line)
|
||||
if sydout_has_buffer:
|
||||
sys.stdout.buffer.write(line)
|
||||
else:
|
||||
sys.stdout.write(line.decode(encoding=enc, errors=err))
|
||||
sys.stdout.flush()
|
||||
# do some munging of the line before we return it
|
||||
line = RE_HIDDEN_BYTES.sub(b'', line)
|
||||
|
|
Loading…
Add table
Reference in a new issue