QProcess emits readyRead too late!



  • 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?


  • Lifetime Qt Champion

    Hi,

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



  • Unfortunately, it's the same!



  • @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);



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.