From 74c38389ca8ec387ba818f0dcab0e78dba62c63b Mon Sep 17 00:00:00 2001 From: con Date: Wed, 15 Dec 2010 16:48:11 +0100 Subject: [PATCH] Use QtcProcess directly, so external tools will start on windows too. --- src/plugins/coreplugin/externaltool.cpp | 25 +++++++++---------------- src/plugins/coreplugin/externaltool.h | 6 ++++-- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/plugins/coreplugin/externaltool.cpp b/src/plugins/coreplugin/externaltool.cpp index bb1cf92dd4a..a73a706d3af 100644 --- a/src/plugins/coreplugin/externaltool.cpp +++ b/src/plugins/coreplugin/externaltool.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include #include @@ -300,7 +299,7 @@ bool ExternalToolRunner::resolve() if (!m_tool) return false; m_resolvedExecutable = QString::null; - m_resolvedArguments.clear(); + m_resolvedArguments = QString::null; m_resolvedWorkingDirectory = QString::null; { // executable foreach (const QString &executable, m_tool->executables()) { @@ -313,15 +312,8 @@ bool ExternalToolRunner::resolve() return false; } { // arguments - QString resolved = Utils::expandMacros(m_tool->arguments(), + m_resolvedArguments = Utils::expandMacros(m_tool->arguments(), Core::VariableManager::instance()->macroExpander()); - // handle quoting in the command line arguments etc - QString cmd; - Utils::QtcProcess::prepareCommand(m_resolvedExecutable, resolved, - &cmd, &m_resolvedArguments); - if (cmd.isEmpty()) - return false; - m_resolvedExecutable = cmd; } { // input m_resolvedInput = Utils::expandMacros(m_tool->input(), @@ -353,7 +345,7 @@ void ExternalToolRunner::run() FileManager::instance()->expectFileChange(m_expectedFileName); } } - m_process = new QProcess; + m_process = new Utils::QtcProcess(this); connect(m_process, SIGNAL(started()), this, SLOT(started())); connect(m_process, SIGNAL(finished(int,QProcess::ExitStatus)), this, SLOT(finished(int,QProcess::ExitStatus))); connect(m_process, SIGNAL(error(QProcess::ProcessError)), this, SLOT(error(QProcess::ProcessError))); @@ -361,11 +353,14 @@ void ExternalToolRunner::run() connect(m_process, SIGNAL(readyReadStandardError()), this, SLOT(readStandardError())); if (!m_resolvedWorkingDirectory.isEmpty()) m_process->setWorkingDirectory(m_resolvedWorkingDirectory); + m_process->setCommand(m_resolvedExecutable, m_resolvedArguments); ICore::instance()->messageManager()->printToOutputPane( tr("Starting external tool '%1'").arg(m_resolvedExecutable), false); - ICore::instance()->messageManager()->printToOutputPane( - tr("with arguments (%1)").arg(m_resolvedArguments.join(QLatin1String(", "))), false); - m_process->start(m_resolvedExecutable, m_resolvedArguments, QIODevice::ReadWrite); + if (!m_resolvedArguments.isEmpty()) { + ICore::instance()->messageManager()->printToOutputPane( + tr("with arguments '%1'").arg(m_resolvedArguments), false); + } + m_process->start(); } void ExternalToolRunner::started() @@ -389,7 +384,6 @@ void ExternalToolRunner::finished(int exitCode, QProcess::ExitStatus status) } ICore::instance()->messageManager()->printToOutputPane( tr("'%1' finished").arg(m_resolvedExecutable), false); - m_process->deleteLater(); deleteLater(); } @@ -400,7 +394,6 @@ void ExternalToolRunner::error(QProcess::ProcessError error) FileManager::instance()->unexpectFileChange(m_expectedFileName); } // TODO inform about errors - m_process->deleteLater(); deleteLater(); } diff --git a/src/plugins/coreplugin/externaltool.h b/src/plugins/coreplugin/externaltool.h index 75fe48c663f..a5b307c6f14 100644 --- a/src/plugins/coreplugin/externaltool.h +++ b/src/plugins/coreplugin/externaltool.h @@ -33,6 +33,8 @@ #include "icore.h" #include "core_global.h" +#include + #include #include #include @@ -105,10 +107,10 @@ private: const ExternalTool *m_tool; QString m_resolvedExecutable; - QStringList m_resolvedArguments; + QString m_resolvedArguments; QString m_resolvedInput; QString m_resolvedWorkingDirectory; - QProcess *m_process; + Utils::QtcProcess *m_process; QTextCodec *m_outputCodec; QTextCodec::ConverterState m_outputCodecState; QTextCodec::ConverterState m_errorCodecState;