[Interest] The right way of using QProcess

Nuno Santos nunosantos at imaginando.pt
Tue May 19 16:29:04 CEST 2015


Hi,

I’m calling the function below with a one second interval while my app is open. The functions executes the command “adb devices"

Is there any kind of limitation by the system by the number of calls? I think my system gets to a point where no more processes can be created: Chrome starts to hang, QtCreator isn’t able to do make, etc

static QString executeAdbCommand(QStringList arguments)
{
    QProcess p;

    //p.setReadChannel(QProcess::StandardError);

    #ifdef Q_OS_MAC
    p.start(QString("%1/adb").arg(QCoreApplication::applicationDirPath()), arguments);
    #endif

    #ifdef Q_OS_WIN
    p.start("adb.exe", arguments);
    #endif

    //qDebug() << "Executing adb" << arguments;

    if (!p.waitForStarted())
       return "";

    if (!p.waitForFinished())
       return "";

    QString output = p.readAll();

    return output;
}

Nuno

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150519/a81e8e32/attachment.html>


More information about the Interest mailing list