SpotlightIterator: Connect to QtcProcess::done() signal

Instead of connecting to errorOccurred() and finished() signals.

Change-Id: I18548db319274ff28c78fc877711ce7536953212
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2022-04-21 22:47:12 +02:00
parent 241d8d014b
commit 3088f32115

View File

@@ -90,11 +90,11 @@ SpotlightIterator::SpotlightIterator(const QStringList &command)
m_process->setCommand({Environment::systemEnvironment().searchInPath(command.first()), m_process->setCommand({Environment::systemEnvironment().searchInPath(command.first()),
command.mid(1)}); command.mid(1)});
m_process->setEnvironment(Utils::Environment::systemEnvironment()); m_process->setEnvironment(Utils::Environment::systemEnvironment());
QObject::connect(m_process.get(), &QtcProcess::finished, [this] { scheduleKillProcess(); }); QObject::connect(m_process.get(), &QtcProcess::done, [this, cmd = command.first()] {
QObject::connect(m_process.get(), &QtcProcess::errorOccurred, [this, command] { if (m_process->result() != ProcessResult::FinishedWithSuccess) {
MessageManager::writeFlashing( MessageManager::writeFlashing(SpotlightLocatorFilter::tr(
SpotlightLocatorFilter::tr("Locator: Error occurred when running \"%1\".") "Locator: Error occurred when running \"%1\".").arg(cmd));
.arg(command.first())); }
scheduleKillProcess(); scheduleKillProcess();
}); });
QObject::connect(m_process.get(), &QtcProcess::readyReadStandardOutput, [this] { QObject::connect(m_process.get(), &QtcProcess::readyReadStandardOutput, [this] {