]> arthur.barton.de Git - bup.git/commit
main: don't lose line prefixes in filter_output
authorNathaniel Filardo <nwf20@cl.cam.ac.uk>
Sun, 18 Aug 2019 16:45:53 +0000 (11:45 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sun, 18 Aug 2019 17:24:49 +0000 (12:24 -0500)
commitafd3ffec3570ee1c0f471bd9399568a9892d076b
tree2d78fb626c6502b1a2724cbfc46538246f69bb25
parenta5574151a48c8af7ff0f5f9c0d4d968f8589010e
main: don't lose line prefixes in filter_output

If the watched process ends a push to the pipe without a newline at
the end, but with newlines in the middle, then sep_rx.split() will
return with multiple entries, the last of which will not end with a
newline and yet not be the empty string.  This line prefix needs to be
stashed into the pending buffer, too.

This turns out to be exactly the same logic as if sep_rx.split had not
split the string, so eliminate one layer of conditionals.

This version incorporates feedback from Rob Browning to continue to
pass a list to extend().

Signed-off-by: Nathaniel Filardo <nwf20@cl.cam.ac.uk>
[rlb@defaultvalue.org: adjust commit summary and remove extra space in
 "if split[0]" guard.]
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
main.py