Ticket #8641: 8641-v1.patch

File 8641-v1.patch, 1.4 KB (added by danielk, 9 years ago)
  • libs/libmyth/util.cpp

     
    3434#endif
    3535
    3636// Qt headers
     37#include <QProcess>
    3738#include <QFile>
    3839#include <QDir>
    3940#include <QFileInfo>
     
    12701271    return false;
    12711272#endif
    12721273
     1274    QStringList args("-c");
     1275
    12731276#if CONFIG_DARWIN || (__FreeBSD__) || defined(__OpenBSD__)
    1274     const char *command = "ps -ax | grep -i pulseaudio | grep -v grep > /dev/null";
     1277    args += "ps -ax | grep -i pulseaudio | grep -v grep";
    12751278#else
    1276     const char *command = "ps -ae | grep pulseaudio > /dev/null";
     1279    args += "ps -ae | grep pulseaudio";
    12771280#endif
    1278     bool res = myth_system(command,
    1279                            MYTH_SYSTEM_DONT_BLOCK_LIRC |
    1280                            MYTH_SYSTEM_DONT_BLOCK_JOYSTICK_MENU |
    1281                            MYTH_SYSTEM_DONT_BLOCK_PARENT);
    1282     return !res;
     1281
     1282    bool ret = false;
     1283    QProcess p;
     1284    p.start("/bin/sh", args, QIODevice::ReadOnly);
     1285    if (p.waitForStarted() && p.waitForFinished())
     1286    {
     1287        QByteArray ba = p.readAllStandardOutput();
     1288        ret = ba.contains("pulseaudio");
     1289        VERBOSE(VB_IMPORTANT,
     1290                QString("pulse audio detection ran successfully %1")
     1291                .arg(ret));
     1292    }
     1293    else
     1294        VERBOSE(VB_IMPORTANT, "pulse audio detection failed to run");
     1295
     1296    return ret;
    12831297}
    12841298
    12851299bool myth_nice(int val)