[Qt-interest] newbie:facing issues with readallstdoutput andQProcess
Thiago Macieira
thiago.macieira at trolltech.com
Mon May 4 21:16:33 CEST 2009
Em Segunda-feira 04 Maio 2009, às 20:43:01, Will Rutherdale (rutherw)
escreveu:
> I've been testing QProcess on a Linux machine. I have my Qt program run
> a script that does output to a mix of STDERR and STDOUT. The Qt program
> connects to all the advertised signals in QProcess, and mostly works.
>
>
>
> I read the QProcess documentation and accordingly called
> setProcessChannelMode( QProcess::MergedChannels ) before calling
> start().
>
>
>
> In my readyReadStandardOutput handler, I call readAllStandardOutput().
> This is supposed to get all the output of the script from both STDOUT
> and STDERR. Unfortunately it only gets the output from STDERR. The
> output from STDOUT appears not to be available anywhere. If I modify
> the script and make all of its output go to STDERR, then the Qt program
> sees everything.
>
>
>
> Is this a known bug in QProcess?
No. Please understand that stdout is buffered in C (and so is cout in
iostream). So unless you flush the data, you won't see anything. Stderr,
however, is not buffered, so anything you write will be seen.
This is a problem in the process you're running (the child process), not in
QProcess.
--
Thiago Macieira - thiago.macieira (AT) nokia.com
Senior Product Manager - Nokia, Qt Software
Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090504/b715c37f/attachment.bin
More information about the Qt-interest-old
mailing list