diff --git a/src/libs/utils/process.cpp b/src/libs/utils/process.cpp index 15281eba671..e145ef176ec 100644 --- a/src/libs/utils/process.cpp +++ b/src/libs/utils/process.cpp @@ -831,8 +831,6 @@ public: emit (q->*signalName)(); } - ProcessResult interpretExitCode(int exitCode); - bool waitForSignal(ProcessSignalType signalType, int msecs); Qt::ConnectionType connectionType() const; void sendControlSignal(ControlSignal controlSignal); @@ -848,7 +846,6 @@ public: ProcessResult m_result = ProcessResult::StartFailed; ChannelBuffer m_stdOut; ChannelBuffer m_stdErr; - ExitCodeInterpreter m_exitCodeInterpreter; int m_hangTimerCount = 0; int m_maxHangTimerCount = defaultMaxHangTimerCount; @@ -1113,15 +1110,6 @@ void ProcessPrivate::clearForRun() m_resultData = {}; } -ProcessResult ProcessPrivate::interpretExitCode(int exitCode) -{ - if (m_exitCodeInterpreter) - return m_exitCodeInterpreter(exitCode); - - // default: - return exitCode ? ProcessResult::FinishedWithError : ProcessResult::FinishedWithSuccess; -} - } // Internal /*! @@ -1858,11 +1846,6 @@ void Process::setTimeOutMessageBoxEnabled(bool v) d->m_timeOutMessageBoxEnabled = v; } -void Process::setExitCodeInterpreter(const ExitCodeInterpreter &interpreter) -{ - d->m_exitCodeInterpreter = interpreter; -} - void Process::setWriteData(const QByteArray &writeData) { d->m_setup.m_writeData = writeData; @@ -2096,7 +2079,8 @@ void ProcessPrivate::handleDone(const ProcessResultData &data) if (m_resultData.m_error != QProcess::FailedToStart) { switch (m_resultData.m_exitStatus) { case QProcess::NormalExit: - m_result = interpretExitCode(m_resultData.m_exitCode); + m_result = m_resultData.m_exitCode ? ProcessResult::FinishedWithError + : ProcessResult::FinishedWithSuccess; break; case QProcess::CrashExit: // Was hang detected before and killed? diff --git a/src/libs/utils/process.h b/src/libs/utils/process.h index 6c3c941b5a7..764b81120ce 100644 --- a/src/libs/utils/process.h +++ b/src/libs/utils/process.h @@ -154,7 +154,6 @@ public: // TODO: We should specify the purpose of the codec, e.g. setCodecForStandardChannel() void setCodec(QTextCodec *c); void setTimeOutMessageBoxEnabled(bool); - void setExitCodeInterpreter(const ExitCodeInterpreter &interpreter); void setStdOutCallback(const TextChannelCallback &callback); void setStdOutLineCallback(const TextChannelCallback &callback); diff --git a/src/libs/utils/processenums.h b/src/libs/utils/processenums.h index 84019bae530..a57817123f8 100644 --- a/src/libs/utils/processenums.h +++ b/src/libs/utils/processenums.h @@ -66,7 +66,6 @@ enum class ProcessResult { Hang }; -using ExitCodeInterpreter = std::function; using TextChannelCallback = std::function; } // namespace Utils diff --git a/src/plugins/bazaar/bazaarclient.h b/src/plugins/bazaar/bazaarclient.h index 5b6ce1e6d48..d4a2c6032f8 100644 --- a/src/plugins/bazaar/bazaarclient.h +++ b/src/plugins/bazaar/bazaarclient.h @@ -31,7 +31,7 @@ public: Utils::Id vcsEditorKind(VcsCommandTag cmd) const override; QString vcsCommandString(VcsCommandTag cmd) const override; - Utils::ExitCodeInterpreter exitCodeInterpreter(VcsCommandTag cmd) const override; + VcsBase::ExitCodeInterpreter exitCodeInterpreter(VcsCommandTag cmd) const override; QStringList revisionSpec(const QString &revision) const override; StatusItem parseStatusLine(const QString &line) const override; diff --git a/src/plugins/vcsbase/vcsbaseclient.cpp b/src/plugins/vcsbase/vcsbaseclient.cpp index 4c90ba5011d..522bcd6d79e 100644 --- a/src/plugins/vcsbase/vcsbaseclient.cpp +++ b/src/plugins/vcsbase/vcsbaseclient.cpp @@ -514,12 +514,6 @@ QString VcsBaseClient::vcsCommandString(VcsCommandTag cmd) const return {}; } -ExitCodeInterpreter VcsBaseClient::exitCodeInterpreter(VcsCommandTag cmd) const -{ - Q_UNUSED(cmd) - return {}; -} - void VcsBaseClient::setDiffConfigCreator(ConfigCreator creator) { m_diffConfigCreator = std::move(creator); diff --git a/src/plugins/vcsbase/vcsbaseclient.h b/src/plugins/vcsbase/vcsbaseclient.h index 9f5f9841f19..f1db56ebeb9 100644 --- a/src/plugins/vcsbase/vcsbaseclient.h +++ b/src/plugins/vcsbase/vcsbaseclient.h @@ -4,9 +4,9 @@ #pragma once #include "vcsbase_global.h" -#include "vcsenums.h" - #include "vcsbaseclientsettings.h" +#include "vcscommand.h" +#include "vcsenums.h" #include #include @@ -32,7 +32,6 @@ namespace VcsBase { class CommandResult; class VcsBaseEditorConfig; class VcsBaseEditorWidget; -class VcsCommand; using CommandHandler = std::function; @@ -61,7 +60,7 @@ public: const QStringList &args) const; void enqueueJob(VcsCommand *cmd, const QStringList &args, - const Utils::ExitCodeInterpreter &interpreter = {}) const; + const ExitCodeInterpreter &interpreter = {}) const; virtual Utils::Environment processEnvironment() const; @@ -207,7 +206,7 @@ public: protected: virtual QString vcsCommandString(VcsCommandTag cmd) const; virtual Utils::Id vcsEditorKind(VcsCommandTag cmd) const = 0; - virtual Utils::ExitCodeInterpreter exitCodeInterpreter(VcsCommandTag cmd) const; + virtual ExitCodeInterpreter exitCodeInterpreter(VcsCommandTag) const { return {}; } virtual QStringList revisionSpec(const QString &/*revision*/) const { return {}; } diff --git a/src/plugins/vcsbase/vcscommand.h b/src/plugins/vcsbase/vcscommand.h index 1cc4d5db54e..e9975dcb140 100644 --- a/src/plugins/vcsbase/vcscommand.h +++ b/src/plugins/vcsbase/vcscommand.h @@ -29,6 +29,8 @@ namespace Internal { class VcsCommandPrivate; } class VcsCommand; +using ExitCodeInterpreter = std::function; + class VCSBASE_EXPORT CommandResult { public: @@ -70,7 +72,7 @@ public: void addJob(const Utils::CommandLine &command, int timeoutS, const Utils::FilePath &workingDirectory = {}, - const Utils::ExitCodeInterpreter &interpreter = {}); + const ExitCodeInterpreter &interpreter = {}); void start(); void addFlags(RunFlags f);