From fdc58bb91360c04eed13a4fd4f8323a6a467dc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 12 Nov 2013 09:23:39 +0100 Subject: Fix console not staying open on minecraft crash --- logic/MinecraftProcess.cpp | 23 ++++++++++++++--------- logic/MinecraftProcess.h | 2 +- 2 files changed, 15 insertions(+), 10 deletions(-) (limited to 'logic') diff --git a/logic/MinecraftProcess.cpp b/logic/MinecraftProcess.cpp index ff122628..6c86c73a 100644 --- a/logic/MinecraftProcess.cpp +++ b/logic/MinecraftProcess.cpp @@ -111,19 +111,24 @@ void MinecraftProcess::on_stdOut() // exit handler void MinecraftProcess::finish(int code, ExitStatus status) { - if (status != NormalExit) + if (!killed) { - // TODO: error handling + if (status == NormalExit) + { + //: Message displayed on instance exit + emit log(tr("Minecraft exited with exitcode %1.").arg(code)); + } + else + { + //: Message displayed on instance crashed + emit log(tr("Minecraft crashed with exitcode %1.").arg(code)); + } } - - // TODO: Localization - - if (!killed) - //: Message displayed on instance exit - emit log(tr("Minecraft exited with exitcode %1.").arg(status)); else + { //: Message displayed after the instance exits due to kill request emit log(tr("Minecraft was killed by user."), MessageLevel::Error); + } m_prepostlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(code)); @@ -138,7 +143,7 @@ void MinecraftProcess::finish(int code, ExitStatus status) } } m_instance->cleanupAfterRun(); - emit ended(m_instance); + emit ended(m_instance, code, status); } void MinecraftProcess::killMinecraft() diff --git a/logic/MinecraftProcess.h b/logic/MinecraftProcess.h index ad887c5b..2a61e172 100644 --- a/logic/MinecraftProcess.h +++ b/logic/MinecraftProcess.h @@ -74,7 +74,7 @@ signals: /** * @brief emitted when mc has finished and the PostLaunchCommand was run */ - void ended(BaseInstance *); + void ended(BaseInstance *, int code, ExitStatus status); /** * @brief emitted when we want to log something -- cgit v1.2.3