QtcProcess: Prepare for implementation some remote functions

Change-Id: I3c3d7d2288b5b607a2c3e933806e2e922c04610f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2021-04-27 15:18:58 +02:00
parent e38c34029f
commit fa23183460
2 changed files with 18 additions and 0 deletions

View File

@@ -70,6 +70,8 @@ QT_END_NAMESPACE
namespace Utils { namespace Utils {
static std::function<void(QtcProcess &)> s_remoteRunProcessHook;
/*! /*!
\class Utils::QtcProcess \class Utils::QtcProcess
@@ -704,6 +706,12 @@ void QtcProcess::setUseCtrlCStub(bool enabled)
void QtcProcess::start() void QtcProcess::start()
{ {
if (m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_remoteRunProcessHook, return);
s_remoteRunProcessHook(*this);
return;
}
Environment env; Environment env;
const OsType osType = HostOsInfo::hostOs(); const OsType osType = HostOsInfo::hostOs();
if (m_haveEnv) { if (m_haveEnv) {
@@ -1230,6 +1238,11 @@ QString QtcProcess::expandMacros(const QString &str, AbstractMacroExpander *mx,
return ret; return ret;
} }
void QtcProcess::setRemoteStartProcessHook(const std::function<void(QtcProcess &)> &hook)
{
s_remoteRunProcessHook = hook;
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void QtcProcess::setupChildProcess() void QtcProcess::setupChildProcess()
{ {

View File

@@ -141,6 +141,11 @@ public:
ArgIterator m_ait; ArgIterator m_ait;
}; };
const CommandLine &commandLine() const { return m_commandLine; }
const Environment &environment() const { return m_environment; }
static void setRemoteStartProcessHook(const std::function<void (QtcProcess &)> &hook);
private: private:
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
void setupChildProcess() override; void setupChildProcess() override;