start/stop zcashd.exe on windows
This commit is contained in:
@@ -146,9 +146,18 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
||||
// Finally, start zcashd
|
||||
qDebug() << "Starting zcashd";
|
||||
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->setWorkingDirectory(fi.dir().absolutePath());
|
||||
QObject::connect(ezcashd, &QProcess::started, [=] () {
|
||||
qDebug() << "zcashd started";
|
||||
Settings::getInstance()->setEmbeddedZcashdRunning(true);
|
||||
@@ -160,7 +169,7 @@ bool ConnectionLoader::startEmbeddedZcashd() {
|
||||
});
|
||||
|
||||
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);
|
||||
|
||||
@@ -20,6 +20,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
std::srand(std::time(nullptr));
|
||||
Settings::init();
|
||||
Settings::getInstance()->setExecName(argv[0]);
|
||||
|
||||
if (argc >= 2 && QString::fromStdString(argv[1]) == "-manual") {
|
||||
Settings::getInstance()->setManualConnection(true);
|
||||
|
||||
@@ -839,6 +839,9 @@ void RPC::shutdownZcashd() {
|
||||
d.setWindowFlags(Qt::SplashScreen);
|
||||
|
||||
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, [&] () {
|
||||
if (ezcashd->atEnd()) {
|
||||
qDebug() << "Ended";
|
||||
|
||||
Reference in New Issue
Block a user