NOISSUE Do not kill running instances when MultiMC shuts down
This commit is contained in:
parent
fc198dd308
commit
c60db13af7
@ -12,6 +12,14 @@ LoggedProcess::LoggedProcess(QObject *parent) : QProcess(parent)
|
|||||||
connect(this, &QProcess::stateChanged, this, &LoggedProcess::on_stateChange);
|
connect(this, &QProcess::stateChanged, this, &LoggedProcess::on_stateChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoggedProcess::~LoggedProcess()
|
||||||
|
{
|
||||||
|
if(m_is_detachable)
|
||||||
|
{
|
||||||
|
setProcessState(QProcess::NotRunning);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QStringList reprocess(const QByteArray & data, QString & leftover)
|
QStringList reprocess(const QByteArray & data, QString & leftover)
|
||||||
{
|
{
|
||||||
QString str = leftover + QString::fromLocal8Bit(data);
|
QString str = leftover + QString::fromLocal8Bit(data);
|
||||||
@ -161,3 +169,8 @@ qint64 LoggedProcess::processId() const
|
|||||||
return pid();
|
return pid();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LoggedProcess::setDetachable(bool detachable)
|
||||||
|
{
|
||||||
|
m_is_detachable = detachable;
|
||||||
|
}
|
||||||
|
@ -39,12 +39,14 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
explicit LoggedProcess(QObject* parent = 0);
|
explicit LoggedProcess(QObject* parent = 0);
|
||||||
virtual ~LoggedProcess() {};
|
virtual ~LoggedProcess();
|
||||||
|
|
||||||
State state() const;
|
State state() const;
|
||||||
int exitCode() const;
|
int exitCode() const;
|
||||||
qint64 processId() const;
|
qint64 processId() const;
|
||||||
|
|
||||||
|
void setDetachable(bool detachable);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void log(QStringList lines, MessageLevel::Enum level);
|
void log(QStringList lines, MessageLevel::Enum level);
|
||||||
void stateChanged(LoggedProcess::State state);
|
void stateChanged(LoggedProcess::State state);
|
||||||
@ -73,4 +75,5 @@ private:
|
|||||||
State m_state = NotRunning;
|
State m_state = NotRunning;
|
||||||
int m_exit_code = 0;
|
int m_exit_code = 0;
|
||||||
bool m_is_aborting = false;
|
bool m_is_aborting = false;
|
||||||
|
bool m_is_detachable = false;
|
||||||
};
|
};
|
||||||
|
@ -51,6 +51,9 @@ void DirectJavaLaunch::executeTask()
|
|||||||
|
|
||||||
m_process.setProcessEnvironment(instance->createEnvironment());
|
m_process.setProcessEnvironment(instance->createEnvironment());
|
||||||
|
|
||||||
|
// make detachable - this will keep the process running even if the object is destroyed
|
||||||
|
m_process.setDetachable(true);
|
||||||
|
|
||||||
auto mcArgs = minecraftInstance->processMinecraftArgs(m_session);
|
auto mcArgs = minecraftInstance->processMinecraftArgs(m_session);
|
||||||
args.append(mcArgs);
|
args.append(mcArgs);
|
||||||
|
|
||||||
|
@ -40,6 +40,9 @@ void LauncherPartLaunch::executeTask()
|
|||||||
|
|
||||||
m_process.setProcessEnvironment(instance->createEnvironment());
|
m_process.setProcessEnvironment(instance->createEnvironment());
|
||||||
|
|
||||||
|
// make detachable - this will keep the process running even if the object is destroyed
|
||||||
|
m_process.setDetachable(true);
|
||||||
|
|
||||||
args << "-jar" << FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "NewLaunch.jar");
|
args << "-jar" << FS::PathCombine(QCoreApplication::applicationDirPath(), "jars", "NewLaunch.jar");
|
||||||
|
|
||||||
QString wrapperCommand = instance->getWrapperCommand();
|
QString wrapperCommand = instance->getWrapperCommand();
|
||||||
|
Loading…
Reference in New Issue
Block a user