[Qt-interest] newbie:facing issues with readallstdoutputandQProcess
Will Rutherdale (rutherw)
rutherw at cisco.com
Mon May 4 22:31:05 CEST 2009
Yes of course, that fixed it.
Thanks.
-Will
-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Thiago Macieira
Sent: 4 May 2009 15:17
To: qt-interest at trolltech.com
Subject: Re: [Qt-interest] newbie:facing issues with readallstdoutputandQProcess
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
More information about the Qt-interest-old
mailing list