Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QProcess::readyReadStandardError on Qt4
Qt 6.11 is out! See what's new in the release blog

QProcess::readyReadStandardError on Qt4

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sameer
    wrote on last edited by Sameer
    #1

    Here's a snippet of my code. I am using a QProcess to launch a "bad" unix command. The "readyReadStandardError" signal is connected to a slot.

    On Qt5.6, this slot gets fired. But on Qt4.8, the slot isn't getting fired.

    Any ideas about what's going on?

    MyClass::MyClass() {
    m_process = new QProcess(this);
    connect(m_process, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput()));
    connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(onReadyReadStandardError()));

     QString cmd = "/bin/sh -c \"/bin/foo\"";
     m_process->start(cmd);
     m_process->waitForFinished();
    

    }

    void MyClass::onReadyReadStandardOutput() {
    std::cout << "Output Ready!!!" << std::endl;
    }

    void MyClass::onReadyReadStandardError() {
    std::cout << "Error Ready!!!" << std::endl;
    }

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      You should check the error code you get from the execution of your command.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sameer
        wrote on last edited by Sameer
        #3

        Thanks!

        After m_process->waitForFinished()

        m_process->errorString() returns "Unknown error"
        m_process->exitCode() returns 127 (which is the unix return code for invalid commands)

        I am trying to read any errors in the slot and print them to a transcript window.
        Things work fine on Qt5.
        On Qt4, the error goes directly to the terminal that the Qt application is run from and the slot is never called.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What version of Qt 4 ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved