NOISSUE fix non-zero exit code from minecraft not being a 'crash'
This commit is contained in:
parent
432e812da1
commit
7ef1f88de7
@ -36,6 +36,9 @@ void LoggedProcess::on_stdOut()
|
|||||||
|
|
||||||
void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status)
|
void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
|
// save the exit code
|
||||||
|
m_exit_code = exit_code;
|
||||||
|
|
||||||
// Flush console window
|
// Flush console window
|
||||||
if (!m_err_leftover.isEmpty())
|
if (!m_err_leftover.isEmpty())
|
||||||
{
|
{
|
||||||
@ -61,7 +64,7 @@ void LoggedProcess::on_exit(int exit_code, QProcess::ExitStatus status)
|
|||||||
{
|
{
|
||||||
//: Message displayed on instance crashed
|
//: Message displayed on instance crashed
|
||||||
if(exit_code == -1)
|
if(exit_code == -1)
|
||||||
emit log({tr("Process crashed.").arg(exit_code)}, MessageLevel::MultiMC);
|
emit log({tr("Process crashed.")}, MessageLevel::MultiMC);
|
||||||
else
|
else
|
||||||
emit log({tr("Process crashed with exitcode %1.").arg(exit_code)}, MessageLevel::MultiMC);
|
emit log({tr("Process crashed with exitcode %1.").arg(exit_code)}, MessageLevel::MultiMC);
|
||||||
changeState(LoggedProcess::Crashed);
|
changeState(LoggedProcess::Crashed);
|
||||||
|
@ -88,8 +88,14 @@ void LaunchMinecraft::on_state(LoggedProcess::State state)
|
|||||||
case LoggedProcess::Finished:
|
case LoggedProcess::Finished:
|
||||||
{
|
{
|
||||||
m_parent->setPid(-1);
|
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
|
//FIXME: make this work again
|
||||||
// auto exitCode = m_process.exitCode();
|
|
||||||
// m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
|
// m_postlaunchprocess.processEnvironment().insert("INST_EXITCODE", QString(exitCode));
|
||||||
// run post-exit
|
// run post-exit
|
||||||
emitSucceeded();
|
emitSucceeded();
|
||||||
|
Loading…
Reference in New Issue
Block a user