[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: KDE/kdelibs/kdeprint
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2007-06-15 16:57:54
Message-ID: 20070615165754.GC20312 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

On 15.06.07 18:45:03, Oswald Buddenhagen wrote:
> On Fri, Jun 15, 2007 at 04:02:14PM +0000, Andreas Pakulat wrote:
> > --- trunk/KDE/kdelibs/kdeprint/tools/escputil/escpwidget.cpp #675966:675967
> > @@ -247,14 +247,16 @@
> >  
> >  void EscpWidget::slotReceivedStdout()
> >  {
> > -	QByteArray bufstr = m_proc.readAllStandardOutput();
> > -	m_outbuffer.append( QString::fromLocal8Bit( bufstr ) );
> > +	while( m_proc.canReadLine() )
> > +		m_outbuffer.append( QString::fromLocal8Bit( m_proc.readLine() ) );
> >  }
> >  
> ok, that's fine in theory (except that you don't handle a possible
> final unterminated line, but that's an unlikely event, i suppose).
> 
> in practice, there is a problem if a line arrives in multiple segments
> and meanwhile data arrives on the other channel ... qprocess discards
> the remaining read buffer on switching channels (including
> readAllStandard*()). that means that always draining the entire buffer
> and doing line splitting yourself is the only safe option when you have
> configured SeparateChannels. oh, btw, tt is denying that this is a bug -
> but hey, they accepted it as an enhancement.

WTF! Thats not only not obvious but clearly a problem. How should a user
of QProcess be able to read error and output separately without loosing
data or having to store 2 buffers. Thats just insane, where's the "Code
less, Create more" here?

Any of our TT contacts want to speak up? Seriously the QProcess API is
really hard to use, the documentation is lacking, thats not what I'm
used to from Qt. And we're already at Qt4.3 here, its not like this
class is new or anything.

Sorry, all these things that Oswald points out make our code using
QProcess/KProcess more complicated for no reason - IMHO (or at least I
don't see any obvious reason).

Andreas

-- 
It was all so different before everything changed.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic