diff options
-rw-r--r-- | src-qt5/core/libLumina/ExternalProcess.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src-qt5/core/libLumina/ExternalProcess.h b/src-qt5/core/libLumina/ExternalProcess.h index 2a6f4949..38994931 100644 --- a/src-qt5/core/libLumina/ExternalProcess.h +++ b/src-qt5/core/libLumina/ExternalProcess.h @@ -21,6 +21,7 @@ class ExternalProcess : public QProcess{ Q_OBJECT private: bool cursorRestored; + QString logoutput; private slots: void resetCursor(){ @@ -46,6 +47,9 @@ private slots: //Clean up this object this->deleteLater(); } + void updateLog(){ + logoutput.append( QString(this->readAllStandardOutput()) ); + } public: ExternalProcess(QString logfile = "", bool manageCursors = false) : QProcess(){ @@ -53,6 +57,8 @@ public: cursorRestored = !manageCursors; if(logfile.isEmpty()){ this->setStandardOutputFile(QProcess::nullDevice()); + }else if(logfile=="stdout"){ + connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(updateLog()); }else{ this->setStandardOutputFile(logfile); } @@ -67,6 +73,11 @@ public: }*/ } + QString log(){ + //NOTE: This will only contain output if the "stdout" argument is used as the logfile + return logoutput; + } + static void launch(QString program, QStringList args = QStringList(), bool manageCursors = true){ //Quick launch of a process with logging disabled and automatic cleanup ExternalProcess *tmp = new ExternalProcess("", manageCursors); |