Results 1 to 7 of 7

Thread: QProcess with a program that call an other ... find stderror

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Re: QProcess with a program that call an other ... find stderror

    Quote Originally Posted by wysota View Post
    Each process has its own set of standard output channels. They are not inherited within the process group. Thus, as already said, your intermediate process would need to catch and forward output of the final process.
    Thnks by the reply and Ok, so the question is how could catch the std output, this is the code that i use:

    I have a class MCompiler : public QProcess

    Qt Code:
    1. MCompiler::MCompiler( )
    2. {
    3. mCompiler = tr( "MCompiler" );
    4.  
    5. QProcessEnvironment pEnv = QProcessEnvironment::systemEnvironment();
    6. pEnv.insert( "TMPDIR", SSPATH );
    7. setProcessEnvironment( pEnv );
    8.  
    9. connect( this, SIGNAL( readyReadStandardOutput( ) ), this, SLOT( compileResult( ) ) );
    10. }
    To copy to clipboard, switch view to plain text mode 

    here is the code when start my compiler

    Qt Code:
    1. void MCompiler::compile( QString fileFullPath )
    2. {
    3. argv << fileFullPath;
    4.  
    5. start( mCompiler, argv );
    6. waitForFinished();
    7. }
    To copy to clipboard, switch view to plain text mode 
    and i have the signal connected to the slot for read the stdOutput

    Qt Code:
    1. void SGWMLSCompiler::compileResult()
    2. {
    3. QByteArray bytes = readAllStandardError();
    4. QStringList lines = QString(bytes).split("\n");
    5.  
    6. foreach (QString line, lines) {
    7. qDebug() << line;
    8. }
    9. }
    To copy to clipboard, switch view to plain text mode 
    And here is where i just get the last std output for Compiler.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QProcess with a program that call an other ... find stderror

    Please understand, there is nothing you can do while calling the "compiler". It is the compiler process that has to catch output of its child process. By the way, you are monitoring standard output but reading standard error. Are you sure you are suppposed to do that?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jan 2012
    Posts
    9
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess with a program that call an other ... find stderror

    Thanks wysota. And for your second comment copy-paste error ... but i´m reading the standard output

Similar Threads

  1. How to call WinWord.exe through the Qt program?
    By bangqianchen in forum Qt Programming
    Replies: 11
    Last Post: 7th September 2010, 14:55
  2. How to call another program?
    By shihao in forum Newbie
    Replies: 15
    Last Post: 17th March 2010, 06:42
  3. How to call the dll's C++ class in Qt program?
    By tszzp in forum Qt Programming
    Replies: 1
    Last Post: 2nd February 2010, 09:38
  4. Call QProcess without GUI
    By mattia in forum Newbie
    Replies: 8
    Last Post: 5th November 2007, 13:39
  5. QProcess error to call mogrify
    By mattia in forum Newbie
    Replies: 2
    Last Post: 29th October 2007, 11:46

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.