summaryrefslogtreecommitdiffstats
path: root/api/logic/launch
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-08-08 09:35:39 +0200
committerPetr Mrázek <peterix@gmail.com>2016-08-10 00:28:33 +0200
commitc60db13af73523c08353f819cc2a8441a7ddbada (patch)
tree0acf18894b9d1e5493e45c2dc48ea665740e3ac4 /api/logic/launch
parentfc198dd3085a2cd33fbaa7a3d2c95c2c8d3ee31a (diff)
downloadMultiMC-c60db13af73523c08353f819cc2a8441a7ddbada.tar
MultiMC-c60db13af73523c08353f819cc2a8441a7ddbada.tar.gz
MultiMC-c60db13af73523c08353f819cc2a8441a7ddbada.tar.lz
MultiMC-c60db13af73523c08353f819cc2a8441a7ddbada.tar.xz
MultiMC-c60db13af73523c08353f819cc2a8441a7ddbada.zip
NOISSUE Do not kill running instances when MultiMC shuts down
Diffstat (limited to 'api/logic/launch')
-rw-r--r--api/logic/launch/LoggedProcess.cpp13
-rw-r--r--api/logic/launch/LoggedProcess.h7
2 files changed, 18 insertions, 2 deletions
diff --git a/api/logic/launch/LoggedProcess.cpp b/api/logic/launch/LoggedProcess.cpp
index 88ca40aa..f89b4acc 100644
--- a/api/logic/launch/LoggedProcess.cpp
+++ b/api/logic/launch/LoggedProcess.cpp
@@ -12,6 +12,14 @@ LoggedProcess::LoggedProcess(QObject *parent) : QProcess(parent)
connect(this, &QProcess::stateChanged, this, &LoggedProcess::on_stateChange);
}
+LoggedProcess::~LoggedProcess()
+{
+ if(m_is_detachable)
+ {
+ setProcessState(QProcess::NotRunning);
+ }
+}
+
QStringList reprocess(const QByteArray & data, QString & leftover)
{
QString str = leftover + QString::fromLocal8Bit(data);
@@ -161,3 +169,8 @@ qint64 LoggedProcess::processId() const
return pid();
#endif
}
+
+void LoggedProcess::setDetachable(bool detachable)
+{
+ m_is_detachable = detachable;
+}
diff --git a/api/logic/launch/LoggedProcess.h b/api/logic/launch/LoggedProcess.h
index baa53d79..c4e5c52c 100644
--- a/api/logic/launch/LoggedProcess.h
+++ b/api/logic/launch/LoggedProcess.h
@@ -38,13 +38,15 @@ public:
};
public:
- explicit LoggedProcess(QObject* parent = 0);
- virtual ~LoggedProcess() {};
+ explicit LoggedProcess(QObject* parent = 0);
+ virtual ~LoggedProcess();
State state() const;
int exitCode() const;
qint64 processId() const;
+ void setDetachable(bool detachable);
+
signals:
void log(QStringList lines, MessageLevel::Enum level);
void stateChanged(LoggedProcess::State state);
@@ -73,4 +75,5 @@ private:
State m_state = NotRunning;
int m_exit_code = 0;
bool m_is_aborting = false;
+ bool m_is_detachable = false;
};