kinit: log messages when service status changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-07 23:45:49 +02:00
parent e7375fce97
commit 936cc87544

View file

@ -283,6 +283,7 @@ int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName,
error = i18n("Could not process service: %1", kservice->entryPath()); error = i18n("Could not process service: %1", kservice->entryPath());
return KLauncherAdaptor::ArgumentsError; return KLauncherAdaptor::ArgumentsError;
} }
kDebug() << "starting" << kservice->entryPath() << urls << blind << dbusServiceName;
const QString program = programandargs.takeFirst(); const QString program = programandargs.takeFirst();
const QStringList programargs = programandargs; const QStringList programargs = programandargs;
Q_ASSERT(m_kstartupinfoid.none() == true); Q_ASSERT(m_kstartupinfoid.none() == true);
@ -326,33 +327,35 @@ int KLauncherAdaptor::start_service_by_desktop_path(const QString &serviceName,
while (true) { while (true) {
QDBusReply<bool> sessionreply = m_dbusconnectioninterface->isServiceRegistered(dbusServiceName); QDBusReply<bool> sessionreply = m_dbusconnectioninterface->isServiceRegistered(dbusServiceName);
if (!sessionreply.isValid()) { if (!sessionreply.isValid()) {
kWarning() << "invalid D-Bus reply for" << dbusServiceName;
sendSIFinish(); sendSIFinish();
error = i18n("Invalid D-Bus reply for: %1", dbusServiceName); error = i18n("Invalid D-Bus reply for: %1", dbusServiceName);
return KLauncherAdaptor::DBusError; return KLauncherAdaptor::DBusError;
} }
// the service unregistered // the service unregistered
if (sessionreply.value() == false && dbusstartuptype == KService::DBusWait) { if (sessionreply.value() == false && dbusstartuptype == KService::DBusWait) {
kDebug() << "service unregistered" << dbusServiceName;
break; break;
} }
// the service registered // the service registered
if (sessionreply.value() == true && dbusstartuptype != KService::DBusWait) { if (sessionreply.value() == true && dbusstartuptype != KService::DBusWait) {
kDebug() << "service registered" << dbusServiceName;
break; break;
} }
// or the program is just not registering the service at all // or the program is just not registering the service at all
if (elapsedtime.elapsed() >= s_servicetimeout && dbusstartuptype != KService::DBusWait) { if (elapsedtime.elapsed() >= s_servicetimeout && dbusstartuptype != KService::DBusWait) {
kWarning() << "timed out for" << pid << ", service name" << dbusServiceName; kWarning() << "timed out while waiting for service" << dbusServiceName;
break; break;
} }
// or the program is not even running // or the program is not even running
if (!isPIDAlive(pid)) { if (!isPIDAlive(pid)) {
kWarning() << "service process is not running" << dbusServiceName;
result = getExitStatus(pid); result = getExitStatus(pid);
kWarning() << "not running" << pid << ", exit status" << result;
break; break;
} }
QApplication::processEvents(QEventLoop::AllEvents, s_eventstime); QApplication::processEvents(QEventLoop::AllEvents, s_eventstime);
QThread::msleep(s_sleeptime); QThread::msleep(s_sleeptime);
} }
kDebug() << "done waiting for" << pid << ", service name" << dbusServiceName;
sendSIFinish(); sendSIFinish();
return result; return result;
} }