[Yum-devel] [PATCH] Fix blank line at end of all scriptlet output

Seth Vidal skvidal at fedoraproject.org
Fri May 21 19:00:09 UTC 2010



On Fri, 21 May 2010, James Antill wrote:

> On Fri, 2010-05-21 at 18:29 +0200, Jeroen van Meeuwen wrote:
>> James Antill wrote:
>>>  IIRC because stdout is not a terminal then stdio/etc. will turn it into
>>> "block buffered" mode. So we tend to get output like:
>>>
>>> "warning: blah\nwarning: foo\nsomethingelse\n"
>>>
>>> ...and we want those as 3 lines, in the DB. So I just did a split(), but
>>> that gives 4 lines. I'm also pretty sure something will give us just
>>> "blah".
>>
>> Would:
>>
>> msg = msg.rstrip()
>>
>> do the trick?
>>
>>>>> print "%r" % msg
>> 'some thing\nelse\n'
>>>>> print msg.rstrip()
>> some thing
>> else
>>>>> print "%r" % msg.rstrip().split('\n')
>> ['some thing', 'else']
>
> 'abcd  '.rstrip() == 'abcd'
>
> ...I guess we could do:
>
> msg.rstrip('\n').split('\n')
>
> ...everyone prefer that?
>

I like splitlines() and then checking if the last line is empty - but 
<shrug>

we're bikeshedding the hell out of this. :)

-sv



More information about the Yum-devel mailing list