Perforce: Avoid one use of SynchronousProcess

Change-Id: Iafa9fcbcd8e902b4fb28834f19bf0c31e3bb9149
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
hjk
2021-04-30 16:58:38 +02:00
parent ecc5c042ab
commit a9da8723fb
2 changed files with 11 additions and 14 deletions

View File

@@ -26,15 +26,13 @@
#include "perforcechecker.h"
#include <utils/qtcassert.h>
#include <utils/synchronousprocess.h>
#include <QRegularExpression>
#include <QTimer>
#include <QFileInfo>
#include <QDir>
#include <QApplication>
#include <QCursor>
#include <QDir>
#include <QFileInfo>
#include <QRegularExpression>
#include <QTimer>
namespace Perforce {
namespace Internal {
@@ -90,7 +88,8 @@ void PerforceChecker::start(const QString &binary, const QString &workingDirecto
if (!workingDirectory.isEmpty())
m_process.setWorkingDirectory(workingDirectory);
m_process.start(m_binary, args);
m_process.setCommand({m_binary, args});
m_process.start();
m_process.closeWriteChannel();
// Timeout handling
m_timeOutMS = timeoutMS;
@@ -109,9 +108,8 @@ void PerforceChecker::slotTimeOut()
if (!isRunning())
return;
m_timedOut = true;
Utils::SynchronousProcess::stopProcess(m_process);
emitFailed(tr("\"%1\" timed out after %2 ms.").
arg(m_binary).arg(m_timeOutMS));
m_process.stopProcess();
emitFailed(tr("\"%1\" timed out after %2 ms.").arg(m_binary).arg(m_timeOutMS));
}
void PerforceChecker::slotError(QProcess::ProcessError error)
@@ -129,7 +127,7 @@ void PerforceChecker::slotError(QProcess::ProcessError error)
case QProcess::ReadError:
case QProcess::WriteError:
case QProcess::UnknownError:
Utils::SynchronousProcess::stopProcess(m_process);
m_process.stopProcess();
break;
}
}

View File

@@ -25,8 +25,7 @@
#pragma once
#include <QObject>
#include <QProcess>
#include <utils/qtcprocess.h>
namespace Perforce {
namespace Internal {
@@ -68,7 +67,7 @@ private:
void parseOutput(const QString &);
inline void resetOverrideCursor();
QProcess m_process;
Utils::QtcProcess m_process;
QString m_binary;
int m_timeOutMS = -1;
bool m_timedOut = false;