Results 1 to 5 of 5

Thread: QProcess StdErr signal question

  1. #1
    Join Date
    Nov 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QProcess StdErr signal question

    Im using QProcess (Qt 4.5) to access console (cmd.exe ) in Windows XP.
    Is has properly connected stdout/stderr/terminate signals.

    When i send something to its write channel it seems to work correctly. CMD responds as it sholud (for ex: dir command,). Im able to read output from stdout channel (result: directory list).
    The problem is when i send some garbage (for ex "aksfvakhv"). Console program sends proper stderr output text ("Command not found" or something) and then it terminates! So I need to restart it again. I tried it with another console program and it behaves the same way.

    Im using readAllStandardError() to do read stderr channel.
    Process sends terminate signal (ExitStatus: NormalExit).

    Qt Code:
    1. void JGI::readStdError()
    2. {
    3. QByteArray errbuffer=cmdProc->readAllStandardError();
    4. ui->cmdStdError->setText(QString::fromLocal8Bit(errbuffer));
    5. }
    To copy to clipboard, switch view to plain text mode 

    Whats wrong?

    Signals are connected properly. Checked n times.
    Last edited by devx; 25th November 2009 at 15:48.

  2. #2
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QProcess StdErr signal question

    I read your post twice and still am not sure what your problem is. Can you perhaps rephrase it?

  3. #3
    Join Date
    Nov 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QProcess StdErr signal question

    The problem is that console process launched by QProcess class terminates itself immediately after sending stderror text message (through stderror channel ofc.).
    Last edited by devx; 25th November 2009 at 18:35.

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QProcess StdErr signal question

    What process are you running? Post some code.

    It sounds completely normal however. If you post garbage, it complains and terminates. Whats wrong with that?

  5. #5
    Join Date
    Nov 2009
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Angry Re: QProcess StdErr signal question

    Normal? For a win cmd.exe ?

    It should work like this
    ----begin
    c:\> dir [enter] / stdin <-
    dir1 blebelbel / stdout ->
    dir2 blebelbel / ..
    dir3 blebelbel / ..
    ....
    c:\> garbage [enter] /stdin <-
    Unknown command.... /stderr ->
    c:\> dir [enter] /stdin <-
    dir1 blebelbel /stdout ->
    dir2 blebelbe l /..
    dir3 blebelbel /..
    -----end

    But works like this:
    ----begin
    c:\> dir [enter] / stdin <-
    dir1 blebelbel / stdout ->
    dir2 blebelbel / ..
    dir3 blebelbel / ..
    ....
    c:\> garbage [enter] / stdin <-
    Unknown command.... / stdout ->
    [cmd.exe terminates] / ??? o.O
    -----end

    // edit:

    Problem solved, it was external program setup fault. Damn.
    Topic can be removed, because its a trash...
    Last edited by devx; 25th November 2009 at 20:08.

Similar Threads

  1. question on QProcess
    By wagmare in forum Qt Programming
    Replies: 3
    Last Post: 17th January 2009, 08:23
  2. pthread instead QThread
    By brevleq in forum Qt Programming
    Replies: 8
    Last Post: 23rd December 2008, 08:16
  3. Connection of custon signals/slots
    By brevleq in forum Qt Programming
    Replies: 2
    Last Post: 23rd December 2008, 08:04
  4. QProcess object not emitting finished(int) signal
    By Tiansen in forum Qt Programming
    Replies: 13
    Last Post: 14th November 2008, 13:17
  5. QProcess question
    By lni in forum Qt Programming
    Replies: 3
    Last Post: 19th July 2007, 20:06

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.