[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Fab-user] multi line output messed up
From: |
Jeff Forcier |
Subject: |
Re: [Fab-user] multi line output messed up |
Date: |
Sun, 12 Jul 2009 12:53:29 -0400 |
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
>