diff options
-rw-r--r-- | src/libs/utils/synchronousprocess.cpp | 15 | ||||
-rw-r--r-- | src/libs/utils/synchronousprocess.h | 3 | ||||
-rw-r--r-- | tests/auto/debugger/tst_dumpers.cpp | 21 |
3 files changed, 10 insertions, 29 deletions
diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index f15eb44938..a52fbd8f7e 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -550,7 +550,7 @@ SynchronousProcessResponse SynchronousProcess::runBlocking(const CommandLine &cm bool SynchronousProcess::terminate() { - return stopProcess(d->m_process); + return d->m_process.stopProcess(); } static inline bool askToKill(const QString &binary = QString()) @@ -582,7 +582,7 @@ void SynchronousProcess::slotTimeout() const bool terminate = !d->m_timeOutMessageBoxEnabled || askToKill(d->m_binary.toString()); d->m_waitingForUser = false; if (terminate) { - SynchronousProcess::stopProcess(d->m_process); + d->m_process.stopProcess(); d->m_result.result = SynchronousProcessResponse::Hang; } else { d->m_hangTimerCount = 0; @@ -689,17 +689,6 @@ bool SynchronousProcess::readDataFromProcess(QProcess &p, int timeoutS, return finished; } -bool SynchronousProcess::stopProcess(QProcess &p) -{ - if (p.state() == QProcess::NotRunning) - return true; - p.terminate(); - if (p.waitForFinished(300)) - return true; - p.kill(); - return p.waitForFinished(300); -} - // Path utilities // Locate a binary in a directory, applying all kinds of diff --git a/src/libs/utils/synchronousprocess.h b/src/libs/utils/synchronousprocess.h index 967e6d4456..f911edbf69 100644 --- a/src/libs/utils/synchronousprocess.h +++ b/src/libs/utils/synchronousprocess.h @@ -142,9 +142,6 @@ public: QByteArray *rawStdOut = nullptr, QByteArray *rawStdErr = nullptr, bool timeOutMessageBox = false); - // Stop a process by first calling terminate() (allowing for signal handling) and - // then kill(). - static bool stopProcess(QProcess &p); // Helpers to find binaries. Do not use it for other path variables // and file types. diff --git a/tests/auto/debugger/tst_dumpers.cpp b/tests/auto/debugger/tst_dumpers.cpp index 861ffcc9dd..01b4df2f1c 100644 --- a/tests/auto/debugger/tst_dumpers.cpp +++ b/tests/auto/debugger/tst_dumpers.cpp @@ -29,10 +29,11 @@ #include "watchutils.h" #include <utils/fileutils.h> -#ifdef Q_OS_WIN #include <utils/environment.h> -#ifdef Q_CC_MSVC #include <utils/qtcprocess.h> + +#ifdef Q_OS_WIN +#ifdef Q_CC_MSVC #include <utils/synchronousprocess.h> #endif // Q_CC_MSVC #endif // Q_OS_WIN @@ -40,6 +41,10 @@ #include <QtTest> #include <math.h> +#ifndef CDBEXT_PATH +#define CDBEXT_PATH "" +#endif + #define MSKIP_SINGLE(x) do { disarm(); QSKIP(x); } while (0) using namespace Debugger; @@ -61,8 +66,6 @@ enum class Language Fortran90 }; -#ifdef Q_CC_MSVC - // Copied from msvctoolchain.cpp to avoid plugin dependency. static bool generateEnvironmentSettings(Utils::Environment &env, const QString &batchFile, @@ -120,7 +123,7 @@ static bool generateEnvironmentSettings(Utils::Environment &env, } if (!run.waitForFinished()) { qWarning("%s: Timeout running '%s'", Q_FUNC_INFO, qPrintable(batchFile)); - Utils::SynchronousProcess::stopProcess(run); + run.stopProcess(); return false; } // The SDK/MSVC scripts do not return exit codes != 0. Check on stdout. @@ -155,12 +158,6 @@ static bool generateEnvironmentSettings(Utils::Environment &env, } -#ifndef CDBEXT_PATH -#define CDBEXT_PATH "" -#endif - -#endif // Q_CC_MSVC - struct VersionBase { // Minimum and maximum are inclusive. @@ -1245,7 +1242,6 @@ void tst_Dumpers::initTestCase() qDebug() << "Make path : " << m_makeBinary; qDebug() << "Gdb version : " << m_debuggerVersion; } else if (m_debuggerEngine == CdbEngine) { -#ifdef Q_CC_MSVC QByteArray envBat = qgetenv("QTC_MSVC_ENV_BAT"); QMap <QString, QString> envPairs; Utils::Environment env = Utils::Environment::systemEnvironment(); @@ -1273,7 +1269,6 @@ void tst_Dumpers::initTestCase() QRegularExpressionMatch match = reg.match(output); if (match.matchType() != QRegularExpression::NoMatch) m_msvcVersion = QString(match.captured(1) + match.captured(2)).toInt(); -#endif //Q_CC_MSVC } else if (m_debuggerEngine == LldbEngine) { qDebug() << "Dumper dir : " << DUMPERDIR; QProcess debugger; |