Logo Search packages:      
Sourcecode: q4wine version File versions  Download package

bool corelib::runProcess ( const QString  exec,
const QStringList  args,
QString  dir = "",
bool  showLog = TRUE 
) const

Runs process.

exec Executable path.
args Arguments.
dir Exec directory.
True on success.

Definition at line 1309 of file q4wine-lib.cpp.

References showError().

Referenced by mountImage(), and umountImage().

                  if (dir.isEmpty())

                  QProcess myProcess;
                  myProcess.setWorkingDirectory (dir);

#ifdef DEBUG
                  qDebug()<<"[ii] corelib::runProcess"<<exec<<args;

                  myProcess.start(exec, args);

                  if (!myProcess.waitForFinished())
                        return false;

                  if (showLog){
                        // Getting env LANG variable
                        QString lang=getenv("LANG");

                        // If in is empty -- set UTF8 locale
                        if (lang.isEmpty())
                              lang = "UTF8";

                        // Read STDERR with locale support
                        QTextCodec *codec = QTextCodec::codecForName(lang.toAscii());
                        QString string = codec->toUnicode(myProcess.readAllStandardError());

                        if (!string.isEmpty()){
                              showError(QObject::tr("It seems the process crashed. STDERR log: %1").arg(string));
                              delete (&codec);
                              return false;
                        delete (&codec);
                  return true;

Generated by  Doxygen 1.6.0   Back to index