[Qt-interest] newbie:facing issues with readallstdoutput andQProcess
Will Rutherdale (rutherw)
rutherw at cisco.com
Mon May 4 20:43:01 CEST 2009
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090504/f9873027/attachment.html
More information about the Qt-interest-old
mailing list