diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp --- a/ksmserver/startup.cpp +++ b/ksmserver/startup.cpp @@ -68,9 +68,9 @@ #include #include +#include #include #include -#include #include #include @@ -679,8 +679,19 @@ } KService service(serviceName); qCInfo(KSMSERVER) << "Starting autostart service " << serviceName; - if( !KRun::runApplication( service, QList(), nullptr, KRun::RunFlags(), QString(), "0" )) - qCInfo(KSMSERVER) << "autostart service" << serviceName << "failed to launch"; + auto p = new KProcess(this); + auto arguments = KIO::DesktopExecParser(service, QList()).resultingArguments(); + if (arguments.isEmpty()) { + qCInfo(KSMSERVER) << "failed to parse" << serviceName << "for autostart"; + continue; + } + auto program = arguments.takeFirst(); + p->setProgram(program, arguments); + p->start(); + connect(p, static_cast(&QProcess::finished), [p](int exitCode) { + qCInfo(KSMSERVER) << "autostart service" << p->program() << "finished with exit code " << exitCode; + p->deleteLater(); + }); } while (true); // Loop till we find a service that we can start. }