当前位置: 首页>>代码示例>>C++>>正文


C++ QProcess::exitStatus方法代码示例

本文整理汇总了C++中QProcess::exitStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ QProcess::exitStatus方法的具体用法?C++ QProcess::exitStatus怎么用?C++ QProcess::exitStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QProcess的用法示例。


在下文中一共展示了QProcess::exitStatus方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: upload

bool Upload::upload(const Package &package)
{
    if (!m_uploadFiles) {
        return true;
    }

    QProcess ssh;
    QStringList arguments;
    QString const auth = "[email protected]";
    arguments << auth;
    arguments << "mkdir" << "-p";
    QString remoteDir = QString("/home/marble/web/monav/") + targetDir();
    arguments << remoteDir;
    ssh.start("ssh", arguments);
    ssh.waitForFinished(1000 * 60 * 10); // wait up to 10 minutes for mkdir to complete
    if (ssh.exitStatus() != QProcess::NormalExit || ssh.exitCode() != 0) {
        qDebug() << "Failed to create remote directory " << remoteDir;
        Logger::instance().setStatus(package.region.id(), package.region.name(), "error", "Failed to create remote directory: " + ssh.readAllStandardError());
        return false;
    }

    QProcess scp;
    arguments.clear();
    arguments << package.file.absoluteFilePath();
    QString target = remoteDir + "/" + package.file.fileName();
    arguments << auth + ":" + target;
    scp.start("scp", arguments);
    scp.waitForFinished(1000 * 60 * 60 * 12); // wait up to 12 hours for upload to complete
    if (scp.exitStatus() != QProcess::NormalExit || scp.exitCode() != 0) {
        qDebug() << "Failed to upload " << target;
        Logger::instance().setStatus(package.region.id(), package.region.name(), "error", "Failed to upload file: " + scp.readAllStandardError());
        return false;
    }

    return adjustNewstuffFile(package);
}
开发者ID:snowy97,项目名称:marble,代码行数:36,代码来源:upload.cpp

示例2: QVERIFY

void tst_QThreadStorage::QTBUG13877_crashOnExit()
{
    QProcess process;
#ifdef Q_OS_WIN
# ifdef QT_NO_DEBUG
    process.start("release/crashOnExit");
# else
    process.start("debug/crashOnExit");
# endif
#else
    process.start("./crashOnExit");
#endif
    QVERIFY(process.waitForFinished());
    QVERIFY(process.exitStatus() != QProcess::CrashExit);
}
开发者ID:dewhisna,项目名称:emscripten-qt,代码行数:15,代码来源:tst_qthreadstorage.cpp

示例3: ready

void Tmpl::ready()
{
    for (QList<TmplExpand>::iterator it = tmpls.begin(); it != tmpls.end(); ++it){
        QProcess *p = it->process;
        if (p && p->state() == QProcess::NotRunning){
            if (p->exitStatus() == QProcess::NormalExit){
                it->bReady = true;
                p->setReadChannel(QProcess::StandardOutput);
                it->res += QString::fromLocal8Bit(p->readAll());
                QTimer::singleShot(0, this, SLOT(clear()));
                return;
            }
        }
    }
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例4: getGSVersion

// Return the GhostScript version string, or QString::null if it couldn't be retrived.
QString getGSVersion()
{
	QStringList args;
	args.append(QString("--version").toLocal8Bit());
	QString gsExe = getShortPathName(PrefsManager::instance()->ghostscriptExecutable());
	QProcess proc;
	proc.start(gsExe.toLocal8Bit(), args);
	if (proc.waitForStarted(5000))
		while (!proc.waitForFinished(5000))
			qApp->processEvents();
	QString gsVer;
	if (proc.exitStatus()==QProcess::NormalExit)
		gsVer = proc.readAllStandardOutput();
	return gsVer;
}
开发者ID:moceap,项目名称:scribus,代码行数:16,代码来源:util_ghostscript.cpp

示例5: runGit

void FuzzyTester::runGit(const QStringList &arguments, QString *output)
{
    QProcess git;
    git.start("git", arguments);
    if (!git.waitForStarted())
        throw TestError("Failed to start git. It is expected to be in the PATH.");
    if (!git.waitForFinished(300000) || git.exitStatus() != QProcess::NormalExit) // 5 minutes ought to be enough for everyone
        throw TestError(QString::fromLatin1("git failed: %1").arg(git.errorString()));
    if (git.exitCode() != 0) {
        throw TestError(QString::fromLatin1("git failed: %1")
                        .arg(QString::fromLocal8Bit(git.readAllStandardError())));
    }
    if (output)
        *output = QString::fromLocal8Bit(git.readAllStandardOutput()).trimmed();
}
开发者ID:BumblingCoder,项目名称:qbs,代码行数:15,代码来源:fuzzytester.cpp

示例6: runQbs

int TestBlackboxBase::runQbs(const QbsRunParameters &params)
{
    QStringList args;
    if (!params.command.isEmpty())
        args << params.command;
    if (supportsBuildDirectoryOption(params.command)) {
        args.append(QLatin1String("-d"));
        args.append(params.buildDirectory.isEmpty() ? QLatin1String(".") : params.buildDirectory);
    }
    args << params.arguments;
    if (params.useProfile)
        args.append(QLatin1String("profile:") + profileName());
    QProcess process;
    process.setProcessEnvironment(params.environment);
    process.start(qbsExecutableFilePath, args);
    const int waitTime = 10 * 60000;
    if (!process.waitForStarted() || !process.waitForFinished(waitTime)) {
        m_qbsStderr = process.readAllStandardError();
        if (!params.expectFailure)
            qDebug("%s", qPrintable(process.errorString()));
        return -1;
    }

    m_qbsStderr = process.readAllStandardError();
    m_qbsStdout = process.readAllStandardOutput();
    sanitizeOutput(&m_qbsStderr);
    sanitizeOutput(&m_qbsStdout);
    if ((process.exitStatus() != QProcess::NormalExit
             || process.exitCode() != 0) && !params.expectFailure) {
        if (!m_qbsStderr.isEmpty())
            qDebug("%s", m_qbsStderr.constData());
        if (!m_qbsStdout.isEmpty())
            qDebug("%s", m_qbsStdout.constData());
    }
    return process.exitStatus() == QProcess::NormalExit ? process.exitCode() : -1;
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例7: QString

QString Nepomuk2::OfficeExtractor::textFromFile(const QUrl &fileUrl, const QString &command, QStringList &arguments)
{
    arguments << fileUrl.toLocalFile();

    // Start a process and read its standard output
    QProcess process;

    process.setReadChannel(QProcess::StandardOutput);
    process.start(command, arguments, QIODevice::ReadOnly);
    process.waitForFinished();

    if (process.exitStatus() != QProcess::NormalExit || process.exitCode() != 0)
        return QString();
    else
        return QString::fromUtf8(process.readAll());
}
开发者ID:KDE,项目名称:nepomuk-core,代码行数:16,代码来源:officeextractor.cpp

示例8: closeMapper

CryptTask::status CryptTask::closeMapper( const QString& p )
{
	QString path = p ;
	path.replace( "\"","\"\"\"" ) ;
	QString e = QString( "%1 -q -d \"%2\"" ).arg( ZULUCRYPTzuluCrypt,path ) ;
	QProcess exe ;
	exe.start( e ) ;
	exe.waitForFinished() ;
	int st = exe.exitStatus() ;
	exe.close() ;
	if( st == 0 ){
		return CryptTask::success ;
	}else{
		return CryptTask::closeMapperFail ;
	}
}
开发者ID:1QGDzEaM4PLVUDU9QreJyaHAtpUZEKfUXS,项目名称:zuluCrypt,代码行数:16,代码来源:crypttask.cpp

示例9: handler

RideFile *QuarqFileReader::openRideFile(QFile &file, QStringList &errors, QList<RideFile*>*) const
{
    (void) errors;
    RideFile *rideFile = new RideFile();
    rideFile->setDeviceType("Quarq Qollector");
    rideFile->setFileFormat("Quarq ANT+ Files (qla)");
    rideFile->setRecIntSecs(1.0);

    QuarqParser handler(rideFile);

    QProcess *antProcess = getInterpreterProcess( installed_path );

    assert(antProcess);

    QXmlInputSource source (antProcess);
    QXmlSimpleReader reader;
    reader.setContentHandler (&handler);

    // this could done be a loop to "save memory."
    file.open(QIODevice::ReadOnly);
    antProcess->write(file.readAll());
    antProcess->closeWriteChannel();
    antProcess->waitForFinished(-1);

    assert(QProcess::NormalExit == antProcess->exitStatus());
    assert(0 == antProcess->exitCode());

    reader.parse(source);

    reader.parseContinue();

    QRegExp rideTime("^.*/(\\d\\d\\d\\d)_(\\d\\d)_(\\d\\d)_"
                     "(\\d\\d)_(\\d\\d)_(\\d\\d)\\.qla$");
    if (rideTime.indexIn(file.fileName()) >= 0) {
        QDateTime datetime(QDate(rideTime.cap(1).toInt(),
                                 rideTime.cap(2).toInt(),
                                 rideTime.cap(3).toInt()),
                           QTime(rideTime.cap(4).toInt(),
                                 rideTime.cap(5).toInt(),
                                 rideTime.cap(6).toInt()));
        rideFile->setStartTime(datetime);
    }

    delete antProcess;

    return rideFile;
}
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:47,代码来源:QuarqRideFile.cpp

示例10: isJollaCameraRunning

bool AutoBarcodeScanner::isJollaCameraRunning() {
    QProcess process;
    QString cmd = "pidof";
    QStringList args("jolla-camera");
    process.start(cmd, args);

    bool result = false;
    if (process.waitForFinished()) {
        result = (process.exitStatus() == QProcess::NormalExit &&
                  process.exitCode() == 0);
    }

    if (result) {
        emit error(AutoBarcodeScanner::JollaCameraRunning);
    }
    return result;
}
开发者ID:martonmiklos,项目名称:sailfish-barcode,代码行数:17,代码来源:AutoBarcodeScanner.cpp

示例11: executeWidgetsgallery

void Pt_WidgetsGallery::executeWidgetsgallery(const QStringList& arguments)
{
    QString program = "widgetsgallery";

    //execute local binary file
    QString sLocalProgram("../../demos/widgetsgallery/widgetsgallery");
    if(QFileInfo(sLocalProgram).exists()) {
        program = sLocalProgram;
    }

    QProcess proc;
    proc.start(program, arguments);
    QVERIFY(proc.waitForStarted());
    QVERIFY(proc.waitForFinished());
    QCOMPARE(proc.exitStatus(), QProcess::NormalExit);
    QCOMPARE(proc.exitCode(), 0);
}
开发者ID:arcean,项目名称:libmeegotouch-framework,代码行数:17,代码来源:pt_widgetsgallery.cpp

示例12: ReadFromFile

bool PackageInfo::ReadFromFile(QString sName)
{
	QProcess procInfo;

	procInfo.setReadChannel(QProcess::StandardOutput);
	procInfo.start("dpkg-deb", QStringList() << "-f" << sName);
	procInfo.waitForFinished(3000);

	if (procInfo.exitStatus() == QProcess::NormalExit) {
		m_qsFilename = sName;
		return ParsePackageInfo(&procInfo);
	}
	else {
		qDebug() << procInfo.readAllStandardError();
	}

	return false;
}
开发者ID:jpoirier,项目名称:x-gauges,代码行数:18,代码来源:SoftwarePackage.cpp

示例13: quarqInterpreterInstalled

bool quarqInterpreterInstalled( void ) {

    static bool checkedInstallation = false;
    static bool installed;

    if (!checkedInstallation) {

      QString interpreterPath="/usr/local/bin/qollector_interpret/build-";
      QStringList executables;
      executables << "linux-i386/qollector_interpret";
      executables << "osx-ppc-i386/qollector_interpret";
      executables << "win32/qollector_interpret.exe";

      for ( QStringList::Iterator ex = executables.begin(); ex != executables.end(); ++ex ) {

	QProcess *antProcess = getInterpreterProcess( interpreterPath + *ex );

	if (NULL == antProcess) {
	  installed = false;
	} else {

	  antProcess->closeWriteChannel();
	  antProcess->waitForFinished(-1);

	  installed=((QProcess::NormalExit == antProcess->exitStatus()) &&
		     (0 == antProcess->exitCode()));

	  delete antProcess;

	  if (installed) {
	    installed_path = interpreterPath + *ex;
	    break;
	  }
	}
      }

      if (!installed)
	//std::cerr << "Cannot open qollector_interpret program, available from http://opensource.quarq.us/qollector_interpret." << std::endl;

      checkedInstallation = true;
    }

    return installed;
}
开发者ID:jasonwiener,项目名称:GoldenCheetah,代码行数:44,代码来源:QuarqRideFile.cpp

示例14: testVersionOption

void tst_QCommandLineParser::testVersionOption()
{
#ifdef QT_NO_PROCESS
    QSKIP("This test requires QProcess support");
#else
#ifdef Q_OS_WINCE
    QSKIP("Reading and writing to a process is not supported on Qt/CE");
#endif
    QCoreApplication app(empty_argc, empty_argv);
    QProcess process;
    process.start("testhelper/qcommandlineparser_test_helper", QStringList() << "0" << "--version");
    QVERIFY(process.waitForFinished(5000));
    QCOMPARE(process.exitStatus(), QProcess::NormalExit);
    QString output = process.readAll();
#ifdef Q_OS_WIN
    output.replace(QStringLiteral("\r\n"), QStringLiteral("\n"));
#endif
    QCOMPARE(output, QString("qcommandlineparser_test_helper 1.0\n"));
#endif // !QT_NO_PROCESS
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:20,代码来源:tst_qcommandlineparser.cpp

示例15: qDebug

void
YTVideoUrlFetcher::runInitialCheck()
{
    QStringList arguments;
    arguments << "--version";

    QProcess process;
    process.start(getYouTubeDLPath(), arguments, QIODevice::ReadOnly);
    process.waitForFinished();

    if (process.exitStatus() == QProcess::NormalExit &&
        process.exitCode() == 0) {
        _version_str = process.readAllStandardOutput();
        _version_str = _version_str.simplified();
        _works = true;
        qDebug() << "youtube-dl works, current version:" << _version_str;
    } else {
        qWarning() << "youtune-dl is non functional:" << process.readAllStandardError();
    }
}
开发者ID:mschaaf,项目名称:sailfish-ytplayer,代码行数:20,代码来源:YTVIdeoUrlFetcher.cpp


注:本文中的QProcess::exitStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。