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
This commit is contained in:
Aleix Pol 2019-05-28 18:42:55 +02:00
parent 835f3dfde9
commit cd7fae95a4

View file

@ -247,7 +247,19 @@ void ApplicationWayland::startSession()
p->setProcessChannelMode(QProcess::ForwardedErrorChannel);
p->setProcessEnvironment(processStartupEnvironment());
auto finishedSignal = static_cast<void (QProcess::*)(int, QProcess::ExitStatus)>(&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