fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fab-user] multi line output messed up


From: Xinan Wu
Subject: Re: [Fab-user] multi line output messed up
Date: Sun, 12 Jul 2009 11:55:59 -0700

No it's the text line that gets eaten because the code pops last line as partail which never gets printed. Before split(\n) would give an empty str at the end of the array and the empty str was popped as patial. I'll give more info when I get back.

On Jul 12, 2009, at 9:53 AM, Jeff Forcier <address@hidden> wrote:

Hi,

Can you give me a specific example of your input/output/expected
output? From what you've said, it sounds like you're having *blank*
lines being eaten, not lines containing text -- is this true? Either
way, detailed info would be helpful :)

I note that str.splitlines() does break on both \r and \n, so the
re.split() should not be necessary.

Thanks,
Jeff


On Fri, Jul 10, 2009 at 11:43 PM, Xinan Wu<address@hidden> wrote:
swallows second line, etc. following is a possible fix.

diff -ur fabric-0.9b1-original/fabric/network.py fabric-0.9b1/ fabric/network.py
--- fabric-0.9b1-original/fabric/network.py     2009-07-02 21:36:15.000000000 
-0700
+++ fabric-0.9b1/fabric/network.py      2009-07-10 20:35:10.000000000 -0700
@@ -318,7 +318,7 @@
# Deal with line breaks, printing all lines and storing the
            # leftovers, if any.
            if '\n' in out or '\r' in out:
-                parts = out.splitlines()
+                parts = re.split(r'\r?\n', out)
                line = leftovers + parts.pop(0)
                if parts:
                    leftovers = parts.pop()



in old fabric-0.1.1, this is used to be out.split('\n')

"1\n2\n".split('\n') -> ['1','2','']
"1\n2\n".splitlines() -> ['1','2']


_______________________________________________
Fab-user mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/fab-user





reply via email to

[Prev in Thread] Current Thread [Next in Thread]