diff --git a/src/libs/utils/synchronousprocess.cpp b/src/libs/utils/synchronousprocess.cpp index bfb9d0d2964..70e65fc8c9f 100644 --- a/src/libs/utils/synchronousprocess.cpp +++ b/src/libs/utils/synchronousprocess.cpp @@ -24,15 +24,18 @@ ****************************************************************************/ #include "synchronousprocess.h" -#include "qtcassert.h" +#include "executeondestruction.h" #include "hostosinfo.h" +#include "qtcassert.h" +#include "qtcprocess.h" #include -#include -#include #include +#include #include +#include #include +#include #include @@ -81,6 +84,8 @@ enum { defaultMaxHangTimerCount = 10 }; namespace Utils { +Q_LOGGING_CATEGORY(processLog, "qtc.utils.synchronousprocess", QtWarningMsg); + // A special QProcess derivative allowing for terminal control. class TerminalControllingProcess : public QProcess { public: @@ -445,8 +450,11 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary, const QStringList &args, const QByteArray &writeData) { - if (debug) - qDebug() << '>' << Q_FUNC_INFO << binary << args; + qCDebug(processLog).noquote() << "Starting:" + << QtcProcess::joinArgs(QStringList(binary) + args); + ExecuteOnDestruction logResult([this] { + qCDebug(processLog) << d->m_result; + }); d->clearForRun(); @@ -492,13 +500,17 @@ SynchronousProcessResponse SynchronousProcess::run(const QString &binary, QApplication::restoreOverrideCursor(); } - if (debug) - qDebug() << '<' << Q_FUNC_INFO << binary << d->m_result; return d->m_result; } SynchronousProcessResponse SynchronousProcess::runBlocking(const QString &binary, const QStringList &args) { + qCDebug(processLog).noquote() << "Starting blocking:" + << QtcProcess::joinArgs(QStringList(binary) + args); + ExecuteOnDestruction logResult([this] { + qCDebug(processLog) << d->m_result; + }); + d->clearForRun(); // On Windows, start failure is triggered immediately if the