forked from qt-creator/qt-creator
Perforce: Avoid one use of SynchronousProcess
Change-Id: Iafa9fcbcd8e902b4fb28834f19bf0c31e3bb9149 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -26,15 +26,13 @@
|
|||||||
#include "perforcechecker.h"
|
#include "perforcechecker.h"
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/synchronousprocess.h>
|
|
||||||
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QDir>
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCursor>
|
#include <QCursor>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -90,7 +88,8 @@ void PerforceChecker::start(const QString &binary, const QString &workingDirecto
|
|||||||
if (!workingDirectory.isEmpty())
|
if (!workingDirectory.isEmpty())
|
||||||
m_process.setWorkingDirectory(workingDirectory);
|
m_process.setWorkingDirectory(workingDirectory);
|
||||||
|
|
||||||
m_process.start(m_binary, args);
|
m_process.setCommand({m_binary, args});
|
||||||
|
m_process.start();
|
||||||
m_process.closeWriteChannel();
|
m_process.closeWriteChannel();
|
||||||
// Timeout handling
|
// Timeout handling
|
||||||
m_timeOutMS = timeoutMS;
|
m_timeOutMS = timeoutMS;
|
||||||
@@ -109,9 +108,8 @@ void PerforceChecker::slotTimeOut()
|
|||||||
if (!isRunning())
|
if (!isRunning())
|
||||||
return;
|
return;
|
||||||
m_timedOut = true;
|
m_timedOut = true;
|
||||||
Utils::SynchronousProcess::stopProcess(m_process);
|
m_process.stopProcess();
|
||||||
emitFailed(tr("\"%1\" timed out after %2 ms.").
|
emitFailed(tr("\"%1\" timed out after %2 ms.").arg(m_binary).arg(m_timeOutMS));
|
||||||
arg(m_binary).arg(m_timeOutMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PerforceChecker::slotError(QProcess::ProcessError error)
|
void PerforceChecker::slotError(QProcess::ProcessError error)
|
||||||
@@ -129,7 +127,7 @@ void PerforceChecker::slotError(QProcess::ProcessError error)
|
|||||||
case QProcess::ReadError:
|
case QProcess::ReadError:
|
||||||
case QProcess::WriteError:
|
case QProcess::WriteError:
|
||||||
case QProcess::UnknownError:
|
case QProcess::UnknownError:
|
||||||
Utils::SynchronousProcess::stopProcess(m_process);
|
m_process.stopProcess();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QObject>
|
#include <utils/qtcprocess.h>
|
||||||
#include <QProcess>
|
|
||||||
|
|
||||||
namespace Perforce {
|
namespace Perforce {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -68,7 +67,7 @@ private:
|
|||||||
void parseOutput(const QString &);
|
void parseOutput(const QString &);
|
||||||
inline void resetOverrideCursor();
|
inline void resetOverrideCursor();
|
||||||
|
|
||||||
QProcess m_process;
|
Utils::QtcProcess m_process;
|
||||||
QString m_binary;
|
QString m_binary;
|
||||||
int m_timeOutMS = -1;
|
int m_timeOutMS = -1;
|
||||||
bool m_timedOut = false;
|
bool m_timedOut = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user