QProcess emits readyRead too late!
General and Desktop
5
Posts
3
Posters
2.3k
Views
2
Watching
-
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?
-
Hi,
Shouldn't you rather use readyReadStandardOutput and/or readyReadStandardError ?
-
@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);