QProcess fills buffer before emit readyRead()
Solved
General and Desktop
-
I'm wokring on Linux (Raspbian) with Qt 5.9.2. Using QProcess to ready the output of some Linux commands (i.e. hcitool) leads to waits until the buffer (? about 4k) is filled before catch the readyRead signal in order to read out the data:
QProcess process; _process.setProcessChannelMode(QProcess::MergedChannels); connect(&_process, &QProcess::readyRead, this, &Example::process_readyRead); process.start("hcitool", QStringList() << "lescan"); // ... void Example::process_readyRead() { QByteArray line; while (!(line = _process.readLine()).isEmpty()) { qDebug() << line; } }
I also tried with the Unbuffered option or readAll function, but they don't change the behavior.
Any idea what's going wrong here?