summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2015-10-18 02:35:47 +0200
committerPetr Mrázek <peterix@gmail.com>2015-10-18 02:35:47 +0200
commit7ef1f88de773c22e4e78c9bfb900b2674d9adb2c (patch)
treee567a6f19d18a2dd01d53323eedaf6584627e254
parent432e812da188f96ad7038772171944a49225371d (diff)
downloadMultiMC-7ef1f88de773c22e4e78c9bfb900b2674d9adb2c.tar
MultiMC-7ef1f88de773c22e4e78c9bfb900b2674d9adb2c.tar.gz
MultiMC-7ef1f88de773c22e4e78c9bfb900b2674d9adb2c.tar.lz
MultiMC-7ef1f88de773c22e4e78c9bfb900b2674d9adb2c.tar.xz
MultiMC-7ef1f88de773c22e4e78c9bfb900b2674d9adb2c.zip
NOISSUE fix non-zero exit code from minecraft not being a 'crash'
-rw-r--r--logic/launch/LoggedProcess.cpp5
-rw-r--r--logic/launch/steps/LaunchMinecraft.cpp8
2 files changed, 11 insertions, 2 deletions
diff --git a/logic/launch/LoggedProcess.cpp b/logic/launch/LoggedProcess.cpp
index 53840621..f6c866de 100644
--- a/logic/launch/LoggedProcess.cpp
+++ b/logic/launch/LoggedProcess.cpp
@@ -36,6 +36,9 @@ void LoggedProcess::on_stdOut()
void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status)
{
+ // save the exit code
+ m_exit_code = exit_code;
+
// Flush console window
if (!m_err_leftover.isEmpty())
{
@@ -61,7 +64,7 @@ void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status)
{
//: Message displayed on instance crashed
if(exit_code == -1)
- emit log({tr("Process crashed.").arg(exit_code)}, MessageLevel::MultiMC);
+ emit log({tr("Process crashed.")}, MessageLevel::MultiMC);
else
emit log({tr("Process crashed with exitcode %1.").arg(exit_code)}, MessageLevel::MultiMC);
changeState(LoggedProcess::Crashed);
diff --git a/logic/launch/steps/LaunchMinecraft.cpp b/logic/launch/steps/LaunchMinecraft.cpp
index 0cbf5f3a..05b1d948 100644
--- a/logic/launch/steps/LaunchMinecraft.cpp
+++ b/logic/launch/steps/LaunchMinecraft.cpp
@@ -88,8 +88,14 @@ void LaunchMinecraft::on_state(LoggedProcess::State state)
case LoggedProcess::Finished:
{
m_parent->setPid(-1);
+ // if the exit code wasn't 0, report this as a crash
+ auto exitCode = m_process.exitCode();
+ if(exitCode != 0)
+ {
+ emitFailed("Game crashed.");
+ return;
+ }
//FIXME: make this work again
- // auto exitCode = m_process.exitCode();
// m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
// run post-exit
emitSucceeded();