QProcess readAll()
-
I'm qorking with QProcess and have a roadblock reading output:
this first routine works: I get content in the QString I can query:
@
void start_server()
{
QProcess *start_adb=new QProcess;
start_adb->start(adbfile + " start-server");
start_adb->waitForFinished(-1);
command=start_adb->readAll();
delete start_adb;if (command.contains("daemon started successfully")) serverRunning = true; else serverRunning = false;
}
@The QString returns empty in the routine below:
@
if (!fileName.isEmpty() )
{QMessageBox::StandardButton reply; reply = QMessageBox::question(this, "Install", "Install "+fileName+"?", QMessageBox::Yes|QMessageBox::No); if (reply == QMessageBox::Yes) { QProcess *install_apk=new QProcess; install_apk->start(adbfile + " install -r" + fileName); install_apk->waitForFinished(-1); command=install_apk->readAll(); delete install_apk; } if (command.contains("failed")) install_failed = true; else install_failed = false;
}
}
@
I can run this command manually and get output succeed or fail.
-
Oops! The command I build was malformed.
This line:
@
install_apk->start(adbfile + " install -r" + fileName);
@should be:
@
install_apk->start(adbfile + " install -r " + fileName);
@Fixed.