start/stop zcashd.exe on windows
This commit is contained in:
@@ -146,9 +146,18 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
// Finally, start zcashd
|
// Finally, start zcashd
|
||||||
qDebug() << "Starting zcashd";
|
qDebug() << "Starting zcashd";
|
||||||
QFileInfo fi(Settings::getInstance()->getExecName());
|
QFileInfo fi(Settings::getInstance()->getExecName());
|
||||||
auto zcashdProgram = fi.dir().filePath("zcashd");
|
#ifdef Q_OS_LINUX
|
||||||
|
auto zcashdProgram = "zcashd";
|
||||||
|
#elif defined(Q_OS_DARWIN)
|
||||||
|
auto zcashdProgram = "zcashd";
|
||||||
|
#else
|
||||||
|
auto zcashdProgram = "zcashd.exe";
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qDebug() << zcashdProgram << QFile(zcashdProgram).exists();
|
||||||
|
|
||||||
ezcashd = new QProcess(main);
|
ezcashd = new QProcess(main);
|
||||||
|
ezcashd->setWorkingDirectory(fi.dir().absolutePath());
|
||||||
QObject::connect(ezcashd, &QProcess::started, [=] () {
|
QObject::connect(ezcashd, &QProcess::started, [=] () {
|
||||||
qDebug() << "zcashd started";
|
qDebug() << "zcashd started";
|
||||||
Settings::getInstance()->setEmbeddedZcashdRunning(true);
|
Settings::getInstance()->setEmbeddedZcashdRunning(true);
|
||||||
@@ -160,7 +169,7 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(ezcashd, &QProcess::errorOccurred, [&] (auto error) mutable {
|
QObject::connect(ezcashd, &QProcess::errorOccurred, [&] (auto error) mutable {
|
||||||
qDebug() << "Couldn't start zcashd: " << error;
|
qDebug() << "Couldn't start zcashd: " << error << ezcashd->errorString();
|
||||||
});
|
});
|
||||||
|
|
||||||
ezcashd->start(zcashdProgram);
|
ezcashd->start(zcashdProgram);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
std::srand(std::time(nullptr));
|
std::srand(std::time(nullptr));
|
||||||
Settings::init();
|
Settings::init();
|
||||||
|
Settings::getInstance()->setExecName(argv[0]);
|
||||||
|
|
||||||
if (argc >= 2 && QString::fromStdString(argv[1]) == "-manual") {
|
if (argc >= 2 && QString::fromStdString(argv[1]) == "-manual") {
|
||||||
Settings::getInstance()->setManualConnection(true);
|
Settings::getInstance()->setManualConnection(true);
|
||||||
|
|||||||
@@ -839,6 +839,9 @@ void RPC::shutdownZcashd() {
|
|||||||
d.setWindowFlags(Qt::SplashScreen);
|
d.setWindowFlags(Qt::SplashScreen);
|
||||||
|
|
||||||
QTimer waiter(main);
|
QTimer waiter(main);
|
||||||
|
|
||||||
|
// We capture by reference all the local variables because of the d.exec()
|
||||||
|
// below, which blocks this function until we exit.
|
||||||
QObject::connect(&waiter, &QTimer::timeout, [&] () {
|
QObject::connect(&waiter, &QTimer::timeout, [&] () {
|
||||||
if (ezcashd->atEnd()) {
|
if (ezcashd->atEnd()) {
|
||||||
qDebug() << "Ended";
|
qDebug() << "Ended";
|
||||||
|
|||||||
Reference in New Issue
Block a user