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 emits readyRead too late!
Forum Updated to NodeBB v4.3 + New Features

QProcess emits readyRead too late!

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 2.3k Views 2 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.
  • D Offline
    D Offline
    dynup
    wrote on last edited by dynup
    #1

    Hi,

    I wrote an appliaction for Android Debug Bridge (adb) to backup app data from an android device. But QProcess doesn't emit readRead signal, although adb gives an output:

    QProcess *process is global in the class!

    process = new QProcess(this);
    connect(process, SIGNAL(readyRead()), this, SLOT(readyRead()));
    connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(finished(int, QProcess::ExitStatus)));
    
    process->start("adb", QStringList() << "blah", QProcess::ReadOnly);
    

    (...)

    void Class::readyRead() {
            qDebug() << "Class::readyRead()";
    }
    

    In terminal the message is coming, than i confirm it on the device and than it's done. In QProcess the readRead signal is emitted after confirming on device! Why?

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

      Hi,

      Shouldn't you rather use readyReadStandardOutput and/or readyReadStandardError ?

      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
      • D Offline
        D Offline
        dynup
        wrote on last edited by
        #3

        Unfortunately, it's the same!

        J 1 Reply Last reply
        0
        • D dynup

          Unfortunately, it's the same!

          J Offline
          J Offline
          jalomic
          wrote on last edited by jalomic
          #4

          @dynup I think data is buffered

          Try to use process->start("adb", QStringList() << "blah", QProcess::ReadOnly | QIODevice::Text);

          or

          Try to use process->start("adb", QStringList() << "blah", QProcess::ReadOnly | QIODevice::Text | QIODevice::Unbuffered);

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dynup
            wrote on last edited by
            #5

            Good idea, thanks! ...but doesn't work.

            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