本文整理汇总了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);
}
示例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);
}
示例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;
}
}
}
}
示例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;
}
示例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();
}
示例6: runQbs
int TestBlackboxBase::runQbs(const QbsRunParameters ¶ms)
{
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;
}
示例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());
}
示例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 ;
}
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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
}
示例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();
}
}