Don't start the process when being in running state

Assert that we are in NotRunning state when starting a process.
Otherwise we issue a warning and ignore the new call.

Change-Id: Ie8c007851aabb4b814c1fd49bc8d01f22eb1a563
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2021-08-25 09:28:05 +02:00
parent f6de80753c
commit 7814605215

View File

@@ -330,10 +330,14 @@ void CallerHandle::start(const QString &program, const QStringList &arguments, c
emit errorOccurred(m_error);
return;
}
auto startWhenRunning = [&program, &oldProgram = m_command] {
qWarning() << "Trying to start" << program << "while" << oldProgram
<< "is still running for the same QtcProcess instance."
<< "The current call will be ignored.";
};
QTC_ASSERT(m_processState == QProcess::NotRunning, startWhenRunning(); return);
m_command = program;
m_arguments = arguments;
// TODO: check if state is not running
// TODO: check if m_canceled is not true
m_writeData = writeData;
auto processLauncherNotStarted = [&program] {
qWarning() << "Trying to start" << program << "while process launcher wasn't started yet.";