fuel-scm/src/LoggedProcess.cpp
2021-09-23 16:18:57 +02:00

22 lines
595 B
C++

#include "LoggedProcess.h"
///////////////////////////////////////////////////////////////////////////////
LoggedProcess::LoggedProcess(QObject *parent) : QProcess(parent)
{
setProcessChannelMode(QProcess::MergedChannels);
connect(this, SIGNAL(readyReadStandardOutput()), this, SLOT(onReadyReadStandardOutput()));
}
void LoggedProcess::getLogAndClear(QByteArray &buffer)
{
QMutexLocker lck(&mutex);
buffer = log;
log.clear();
}
void LoggedProcess::onReadyReadStandardOutput()
{
QMutexLocker lck(&mutex);
log.append(readAllStandardOutput());
}