summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@kde.org>2017-04-13 10:02:15 (GMT)
committerLuboš Luňák <l.lunak@kde.org>2017-04-21 12:00:30 (GMT)
commitda44dd6eae8b9ef4161680efcb9319a7267fe77e (patch)
tree477dc23892cbd7939eb084e2264edccf9b9ccf0b
parent71908e79626b240d1c32ee88d726c227fa7d6a2d (diff)
launch autostart apps in ksmserver using KRun, not QProcess
The "move" (copy in fact) of the autostart code from klauncher simply switched to QProcess. This resulted in a number of problems, as the incorrect handling of .desktop file command if it had placeholders (worked around already), kdeinit is no longer used (not sure how much that matters nowadays) and finally QProcess simply eats all stdout/stderr of all such processes (which, when daemonized, can lead even to the processes getting SIGPIPE'd). If the application to start is a KService, simply launch it as such. BUG: 369391 BUG: 370528
-rw-r--r--ksmserver/startup.cpp16
1 files changed, 3 insertions, 13 deletions
diff --git a/ksmserver/startup.cpp b/ksmserver/startup.cpp
index 2514e85..36bab54 100644
--- a/ksmserver/startup.cpp
+++ b/ksmserver/startup.cpp
@@ -68,9 +68,9 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include <kconfig.h>
#include <kconfiggroup.h>
-#include <kio/desktopexecparser.h>
#include <KSharedConfig>
#include <kprocess.h>
+#include <krun.h>
#include <KNotifyConfig>
#include <KService>
@@ -677,18 +677,8 @@ void KSMServer::slotAutoStart()
}
KService service(serviceName);
qCInfo(KSMSERVER) << "Starting autostart service " << serviceName;
- auto p = new QProcess(this);
- auto arguments = KIO::DesktopExecParser(service, QList<QUrl>()).resultingArguments();
- if (arguments.isEmpty()) {
- qCInfo(KSMSERVER) << "failed to parse" << serviceName << "for autostart";
- continue;
- }
- auto program = arguments.takeFirst();
- p->start(program, arguments);
- connect(p, static_cast<void (QProcess::*)(int)>(&QProcess::finished), [p](int exitCode) {
- qCInfo(KSMSERVER) << "autostart service" << p->program() << "finished with exit code " << exitCode;
- p->deleteLater();
- });
+ if( !KRun::runApplication( service, QList<QUrl>(), nullptr, KRun::RunFlags(), QString(), "0" ))
+ qCInfo(KSMSERVER) << "autostart service" << serviceName << "failed to launch";
} while (true);
// Loop till we find a service that we can start.
}