QtcProcess: Recreate process interface on every start

Since the input data may have changed in meantime.
Ensure we are not running when restarting the process.

Change-Id: I79a515b3c0526a6315027433fd821698fb2c6e94
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2022-02-16 10:40:02 +01:00
parent 82c2450fbe
commit 86017efdd4

View File

@@ -480,14 +480,6 @@ public:
this, &QtcProcessPrivate::handleReadyReadStandardError);
}
void ensureProcessInterfaceExists()
{
if (m_process)
return;
setProcessInterface(createProcessInterface());
}
void handleReadyReadStandardOutput()
{
m_stdOut.append(m_process->readAllStandardOutput());
@@ -767,12 +759,14 @@ void QtcProcess::setUseCtrlCStub(bool enabled)
void QtcProcess::start()
{
QTC_ASSERT(state() == QProcess::NotRunning, return);
if (d->m_setup.m_commandLine.executable().needsDevice()) {
QTC_ASSERT(s_deviceHooks.startProcessHook, return);
s_deviceHooks.startProcessHook(*this);
return;
}
d->ensureProcessInterfaceExists();
setProcessInterface(d->createProcessInterface());
d->clearForRun();
d->m_process->m_setup.m_commandLine = d->fullCommandLine();
d->m_process->m_setup.m_environment = d->fullEnvironment();