#49 Capture embedded zcashd errors
This commit is contained in:
@@ -221,9 +221,16 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
if (!Settings::getInstance()->useEmbedded())
|
if (!Settings::getInstance()->useEmbedded())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// Static because it needs to survice even after this method returns.
|
||||||
|
static QString processStdErrOutput;
|
||||||
|
|
||||||
if (ezcashd != nullptr) {
|
if (ezcashd != nullptr) {
|
||||||
if (ezcashd->state() == QProcess::NotRunning) {
|
if (ezcashd->state() == QProcess::NotRunning) {
|
||||||
qDebug() << "Process started and then crashed";
|
qDebug() << "Process started and then crashed";
|
||||||
|
if (!processStdErrOutput.isEmpty()) {
|
||||||
|
QMessageBox::critical(main, "zcashd error", "zcashd said: " + processStdErrOutput,
|
||||||
|
QMessageBox::Ok);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
@@ -255,13 +262,19 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
|
|
||||||
QObject::connect(ezcashd, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
QObject::connect(ezcashd, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished),
|
||||||
[=](int, QProcess::ExitStatus) {
|
[=](int, QProcess::ExitStatus) {
|
||||||
//qDebug() << "zcashd finished with code " << exitCode << "," << exitStatus;
|
//qDebug() << "zcashd finished with code " << exitCode << "," << exitStatus;
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(ezcashd, &QProcess::errorOccurred, [&] (auto) {
|
QObject::connect(ezcashd, &QProcess::errorOccurred, [&] (auto) {
|
||||||
//qDebug() << "Couldn't start zcashd: " << error;
|
//qDebug() << "Couldn't start zcashd: " << error;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QObject::connect(ezcashd, &QProcess::readyReadStandardError, [=]() {
|
||||||
|
auto output = ezcashd->readAllStandardError();
|
||||||
|
qDebug() << "zcashd stderr:" << output;
|
||||||
|
processStdErrOutput.append(output);
|
||||||
|
});
|
||||||
|
|
||||||
#ifdef Q_OS_LINUX
|
#ifdef Q_OS_LINUX
|
||||||
ezcashd->start(zcashdProgram);
|
ezcashd->start(zcashdProgram);
|
||||||
#elif defined(Q_OS_DARWIN)
|
#elif defined(Q_OS_DARWIN)
|
||||||
|
|||||||
Reference in New Issue
Block a user