diff options
author | Ken Moore <ken@ixsystems.com> | 2017-12-04 11:25:33 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-12-04 11:25:33 -0500 |
commit | 79ccca2b82f7a91c68e09ec7eae17a0ca283d0b7 (patch) | |
tree | e8ffc2a2ad0b3a5a6ec92b2873d6f703b9049e7f /src-qt5/core | |
parent | Merge branch 'master' of github.com:trueos/lumina (diff) | |
download | lumina-79ccca2b82f7a91c68e09ec7eae17a0ca283d0b7.tar.gz lumina-79ccca2b82f7a91c68e09ec7eae17a0ca283d0b7.tar.bz2 lumina-79ccca2b82f7a91c68e09ec7eae17a0ca283d0b7.zip |
Add the option to use stdout as an option for ExternalProcess.
Diffstat (limited to 'src-qt5/core')
-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); |