From 9418c62d95d8a9e829b087386cba2e2b6137daf1 Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Wed, 22 Mar 2023 10:32:17 +0100 Subject: [PATCH] refactor: reprocess log lines per instance Signed-off-by: Sefa Eyeoglu --- launcher/LoggedProcess.cpp | 5 +---- launcher/LoggedProcess.h | 7 +++++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/launcher/LoggedProcess.cpp b/launcher/LoggedProcess.cpp index 43a9c4f6..c8d5c34e 100644 --- a/launcher/LoggedProcess.cpp +++ b/launcher/LoggedProcess.cpp @@ -61,13 +61,10 @@ LoggedProcess::~LoggedProcess() } } -static QString m_leftover_line; - -QStringList reprocess(const QByteArray& data, QTextDecoder& decoder) +QStringList LoggedProcess::reprocess(const QByteArray& data, QTextDecoder& decoder) { auto str = decoder.toUnicode(data); - // FIXME: Flush this out when process exits if (!m_leftover_line.isEmpty()) { str.prepend(m_leftover_line); m_leftover_line = ""; diff --git a/launcher/LoggedProcess.h b/launcher/LoggedProcess.h index 2360d1ea..af3ed79f 100644 --- a/launcher/LoggedProcess.h +++ b/launcher/LoggedProcess.h @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-3.0-only /* - * PolyMC - Minecraft Launcher - * Copyright (C) 2022 Sefa Eyeoglu + * Prism Launcher - Minecraft Launcher + * Copyright (C) 2022,2023 Sefa Eyeoglu * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -88,9 +88,12 @@ private slots: private: void changeState(LoggedProcess::State state); + QStringList reprocess(const QByteArray& data, QTextDecoder& decoder); + private: QTextDecoder m_err_decoder = QTextDecoder(QTextCodec::codecForLocale()); QTextDecoder m_out_decoder = QTextDecoder(QTextCodec::codecForLocale()); + QString m_leftover_line; bool m_killed = false; State m_state = NotRunning; int m_exit_code = 0;