KProcess Line Mode Patch

Thiago Macieira thiago at kde.org
Tue Dec 2 16:14:00 GMT 2008


On Tuesday 02 December 2008 16:23:59 Ralf Habacker wrote:
> When searching for readyReadStandardOutput on
> http://lxr.kde.org/ident?i=readyReadStandardOutput shows I got 130
> references in 81 files.
> Inspecting them shows several problematic implementations of our related
> topic

You pasted one issue with line-oriented reading (you have to use the readLine 
overload that returns qint64 if your device is sequential, like QProcess) and 
the rest are encoding issues.

The encoding issues are properly solved with QTextStream, since it maintains 
the encoder status correctly. Unterminated UTF-8 sequences would be delayed 
until the next read. In fact, unterminated sequences of any encoding.

But, as Oswald pointed out, the problem is that QTextStream isn't suitable for 
sequential devices. That's something to be fixed in Qt. (make sure that all 
device reads check for return == 0, which indicates incomplete data)

If anyone wants to give a go, I'm offering to run the unit tests for 
QTextStream.

(Dammit, we should have released the whole testsuite already...)
-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Senior Software Engineer - Nokia, Qt Software
  Qt Software is hiring - ask me
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20081202/c01e5556/attachment.sig>


More information about the kde-core-devel mailing list