diff --git a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp index 4c43a9832f8..3dde746a91e 100644 --- a/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp +++ b/src/plugins/coreplugin/locator/spotlightlocatorfilter.cpp @@ -90,11 +90,11 @@ SpotlightIterator::SpotlightIterator(const QStringList &command) m_process->setCommand({Environment::systemEnvironment().searchInPath(command.first()), command.mid(1)}); m_process->setEnvironment(Utils::Environment::systemEnvironment()); - QObject::connect(m_process.get(), &QtcProcess::finished, [this] { scheduleKillProcess(); }); - QObject::connect(m_process.get(), &QtcProcess::errorOccurred, [this, command] { - MessageManager::writeFlashing( - SpotlightLocatorFilter::tr("Locator: Error occurred when running \"%1\".") - .arg(command.first())); + QObject::connect(m_process.get(), &QtcProcess::done, [this, cmd = command.first()] { + if (m_process->result() != ProcessResult::FinishedWithSuccess) { + MessageManager::writeFlashing(SpotlightLocatorFilter::tr( + "Locator: Error occurred when running \"%1\".").arg(cmd)); + } scheduleKillProcess(); }); QObject::connect(m_process.get(), &QtcProcess::readyReadStandardOutput, [this] {