From cd7fae95a4c0f1c1524a84cebc81fa44bffa17be Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Tue, 28 May 2019 18:42:55 +0200 Subject: [PATCH] Forward and log exit code of the nested process Summary: Otherwise it's hard to tell if it failed. Test Plan: Found out that my session was crashing. Reviewers: #kwin, zzag Reviewed By: #kwin, zzag Subscribers: zzag, kwin Tags: #kwin Differential Revision: https://phabricator.kde.org/D21465 --- main_wayland.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/main_wayland.cpp b/main_wayland.cpp index 14472fcb32..40336ae741 100644 --- a/main_wayland.cpp +++ b/main_wayland.cpp @@ -247,7 +247,19 @@ void ApplicationWayland::startSession() p->setProcessChannelMode(QProcess::ForwardedErrorChannel); p->setProcessEnvironment(processStartupEnvironment()); auto finishedSignal = static_cast(&QProcess::finished); - connect(p, finishedSignal, this, &ApplicationWayland::quit); + connect(p, finishedSignal, this, [](int code, QProcess::ExitStatus status) { + if (status == QProcess::CrashExit) { + qWarning() << "Session process has crashed"; + QCoreApplication::exit(-1); + return; + } + + if (code) { + qWarning() << "Session process exited with code" << code; + } + + QCoreApplication::exit(code); + }); p->start(m_sessionArgument); } // start the applications passed to us as command line arguments