Introduce processImplHook

Call new hook from inside QtcProcess::start().
This hook calls new virtual method
IDevice::createProcessInterface().
That's all what should be needed from device
to setup properly device specific process.

Make QtcProcess::createProcessInterface() private now.

Change-Id: I2136698063bafc846ebc2d3db6cc11376902eff0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-21 12:49:14 +01:00
parent d979bd8da9
commit fd7bf831ba
5 changed files with 33 additions and 6 deletions

View File

@@ -822,12 +822,21 @@ void QtcProcess::start()
// TODO: Uncomment when we de-virtualize start()
// QTC_ASSERT(state() == QProcess::NotRunning, return);
ProcessInterface *processImpl = nullptr;
if (d->m_setup.m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_deviceHooks.startProcessHook, return);
s_deviceHooks.startProcessHook(*this);
return;
if (s_deviceHooks.processImplHook) { // TODO: replace "if" with an assert for the hook
processImpl = s_deviceHooks.processImplHook(commandLine().executable());
}
if (!processImpl) { // TODO: remove this branch when docker is adapted accordingly
QTC_ASSERT(s_deviceHooks.startProcessHook, return);
s_deviceHooks.startProcessHook(*this);
return;
}
} else {
processImpl = d->createProcessInterface();
}
setProcessInterface(d->createProcessInterface());
QTC_ASSERT(processImpl, return);
setProcessInterface(processImpl);
d->clearForRun();
d->m_process->m_setup.m_commandLine = d->fullCommandLine();
d->m_process->m_setup.m_environment = d->fullEnvironment();