[Qt-interest] newbie:facing issues with readallstdoutput andQProcess

chandrasekar wagmare sekarwagmare at gmail.com
Tue May 5 10:48:23 CEST 2009


once i try to run an external system call glxgears in linux , i cant get the
stdout in my qprocess and so one of the qt expert suggest me this ...
  *"Most probably it's a problem of an incorrectly setup buffering method...
and
you won't be able to solve this from within your calling program.
Either "patch" the program you are calling to use line buffering --
setlinebuf(stdout) -- or use fflush(stdout) every now and then in this
program. If you can't do this, then there's no way to solve it.

It's NOT a problem of QProcess or anything you could solve by any trickery
here... I have similar issues with some of the programs that I call from
some
of my apps and there's no way around it (at least no platform independent
one).

I've never tried this with glxgears, but an easy way to check if it is one
of
those programs which behave "incorrectl" would be to use "glxgears | less"
for example. This is basically the same...

(yes, just confirmed: it behaves exactly this way!)"*   i am not sure u are
facing this problem but it might help you ...

On Tue, May 5, 2009 at 12:13 AM, Will Rutherdale (rutherw) <
rutherw at cisco.com> wrote:

>  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?
>
>
>
> -Will
>
>
>
>
>  ------------------------------
>
> *From:* qt-interest-bounces at trolltech.com [mailto:
> qt-interest-bounces at trolltech.com] *On Behalf Of *john doe
> *Sent:* 4 May 2009 13:20
> *To:* Stephen Jackson
> *Cc:* qt-interest at trolltech.com
> *Subject:* Re: [Qt-interest] newbie:facing issues with readallstdoutput
> andQProcess
>
>
>
>
>
> On Sun, May 3, 2009 at 11:44 PM, Stephen Jackson <spjackson42 at gmail.com>
> wrote:
>
> On 04/05/09, john doe wrote:
> >
> > If I use program=python; and arguments << "version" or "-version" or
> > "--version" no stdoutput or stderror is read back!
> >  Can someone please help ?
> >
>
> The code you posted only reads stdout, not stderr. If you run python
> with the 3 different arguments you mention here, it writes to stderr
> not stdout. If you want to read stderr, the QProcess documentation
> explains how to do this.
>
>
> Thanks for the answer :-), the problem is though if I try to run python -h,
> I can see the output, but python --version won't work.!!!! I can't figure
> out why a particular flag works and the other one does not!
> [code]
>
>  program="python";
>
> arguments << "-V" ; //arguments << "--version"
>
> [/code]
>
> does not work
>
> [code]
>
> program="python";
>
> arguments << "-h" ;
>
> [/code]
>
> works!
>
>
> Also, I want to run external programs and read their stdoutpout and
> stderror. can I read in both into the same text box?
>
>
>
>
> Regards,
>
> Stephen Jackson
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>


-- 
WAGMARE
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090505/5035cc2a/attachment.html 


More information about the Qt-interest-old mailing list