Minor: add runtime information in debug output.
This commit is contained in:
parent
4b3a39b0e6
commit
24351b8342
@ -4,6 +4,7 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
|
#include <QDateTime>
|
||||||
|
|
||||||
Command::Command(QString const &command, int start_timeout, int finish_timeout)
|
Command::Command(QString const &command, int start_timeout, int finish_timeout)
|
||||||
: m_command(command.trimmed())
|
: m_command(command.trimmed())
|
||||||
@ -65,6 +66,8 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
|||||||
p->start(m_command);
|
p->start(m_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint64 const start = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
|
|
||||||
if (p->waitForStarted(m_waitForStartTimeout)) {
|
if (p->waitForStarted(m_waitForStartTimeout)) {
|
||||||
qDebug() << "PROCESS" << m_command << "STARTED IN" << p->workingDirectory();
|
qDebug() << "PROCESS" << m_command << "STARTED IN" << p->workingDirectory();
|
||||||
if (p->state() == QProcess::ProcessState::Running) {
|
if (p->state() == QProcess::ProcessState::Running) {
|
||||||
@ -80,31 +83,41 @@ bool Command::execute(QString workingDirectory, QStringList args) {
|
|||||||
qDebug() << "PROCESS" << m_command << "FINISHED IN" << p->workingDirectory();
|
qDebug() << "PROCESS" << m_command << "FINISHED IN" << p->workingDirectory();
|
||||||
if (p->exitStatus() == QProcess::NormalExit) {
|
if (p->exitStatus() == QProcess::NormalExit) {
|
||||||
if ((m_exitCode = p->exitCode()) == 0) {
|
if ((m_exitCode = p->exitCode()) == 0) {
|
||||||
|
qint64 const end = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
qDebug() << "EXECUTED" << m_command
|
qDebug() << "EXECUTED" << m_command
|
||||||
|
<< QString("(runtime %1ms)").arg(end-start)
|
||||||
<< "with code" << m_exitCode
|
<< "with code" << m_exitCode
|
||||||
<< "IN" << p->workingDirectory();
|
<< "IN" << p->workingDirectory();
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
qint64 const end = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
qCritical() << "EXECUTED" << m_command
|
qCritical() << "EXECUTED" << m_command
|
||||||
|
<< QString("(runtime %1ms)").arg(end-start)
|
||||||
<< "with code" << m_exitCode
|
<< "with code" << m_exitCode
|
||||||
<< "IN" << p->workingDirectory();
|
<< "IN" << p->workingDirectory();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
qint64 const end = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
qCritical() << "PROCESS" << m_command << "CRASHED with code"
|
qCritical() << "PROCESS" << m_command << "CRASHED with code"
|
||||||
<< p->exitCode()
|
<< p->exitCode()
|
||||||
|
<< QString("(after %1ms)").arg(end-start)
|
||||||
<< "IN" << p->workingDirectory();
|
<< "IN" << p->workingDirectory();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
qint64 const end = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
qCritical() << "PROCESS" << m_command
|
qCritical() << "PROCESS" << m_command
|
||||||
<< "DID NOT FINISH WITH" << wait
|
<< "DID NOT FINISH WITH" << wait
|
||||||
<< "MS IN" << p->workingDirectory();
|
<< "MS IN" << p->workingDirectory()
|
||||||
|
<< QString("(runtime %1ms)").arg(end-start);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
qCritical() << "WRONG PROCESS STATE" << p->state()
|
qCritical() << "WRONG PROCESS STATE" << p->state()
|
||||||
<< "IN" << p->workingDirectory();
|
<< "IN" << p->workingDirectory();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
qint64 const end = QDateTime::currentDateTime().toMSecsSinceEpoch();
|
||||||
qCritical() << "PROCESS" << m_command << "TIMEOUT AT START"
|
qCritical() << "PROCESS" << m_command << "TIMEOUT AT START"
|
||||||
|
<< QString("(runtime %1ms)").arg(end-start)
|
||||||
<< "IN" << p->workingDirectory();
|
<< "IN" << p->workingDirectory();
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user