aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/projectexplorer/abstractprocessstep.cpp
diff options
context:
space:
mode:
authorhjk <hjk@qt.io>2019-05-28 18:59:45 +0200
committerhjk <hjk@qt.io>2019-05-29 14:36:46 +0000
commit4098be05b23dd20aaf752fb9aec79fe8d90a4220 (patch)
treeb593688a2f5808fb42221dcf4127faeba0d8c6c6 /src/plugins/projectexplorer/abstractprocessstep.cpp
parentf50859e856b911ba0667fc9aaa5df4c8882f8679 (diff)
Utils: Extract a CommandLine structure from a QtcProcess
We regularly pass around strings or filenames or pairs of strings or filenames and stringlist etc the in the end will be used as a kind of "command line", with quite a bit of ad-hoc user code and QtcProcess::addArg etc to set them up and manipulate them. Let's have a class for that concept. Change-Id: I288ab939d853b32c717135a65242c584c2beab50 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'src/plugins/projectexplorer/abstractprocessstep.cpp')
-rw-r--r--src/plugins/projectexplorer/abstractprocessstep.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/projectexplorer/abstractprocessstep.cpp b/src/plugins/projectexplorer/abstractprocessstep.cpp
index 106f58b006..1d92fa9280 100644
--- a/src/plugins/projectexplorer/abstractprocessstep.cpp
+++ b/src/plugins/projectexplorer/abstractprocessstep.cpp
@@ -48,6 +48,8 @@
#include <algorithm>
#include <memory>
+using namespace Utils;
+
namespace ProjectExplorer {
/*!
@@ -211,8 +213,8 @@ void AbstractProcessStep::doRun()
}
}
- QString effectiveCommand = d->m_param.effectiveCommand().toString();
- if (!QFileInfo::exists(effectiveCommand)) {
+ const CommandLine effectiveCommand{d->m_param.effectiveCommand(), d->m_param.effectiveArguments()};
+ if (!effectiveCommand.executable().exists()) {
processStartupFailed();
finish(false);
return;
@@ -222,7 +224,7 @@ void AbstractProcessStep::doRun()
d->m_process->setUseCtrlCStub(Utils::HostOsInfo::isWindowsHost());
d->m_process->setWorkingDirectory(wd.absolutePath());
d->m_process->setEnvironment(d->m_param.environment());
- d->m_process->setCommand(effectiveCommand, d->m_param.effectiveArguments());
+ d->m_process->setCommand(effectiveCommand);
connect(d->m_process.get(), &QProcess::readyReadStandardOutput,
this, &AbstractProcessStep::processReadyReadStdOutput);