mirror of
https://github.com/monero-project/monero-gui.git
synced 2024-11-16 15:58:11 +00:00
DaemonManager: windows support
This commit is contained in:
parent
5da9f8fbe4
commit
3df9e44849
1 changed files with 21 additions and 5 deletions
|
@ -21,17 +21,33 @@ DaemonManager *DaemonManager::instance()
|
|||
|
||||
bool DaemonManager::start()
|
||||
{
|
||||
QString program = QApplication::applicationDirPath() + "/monerod";
|
||||
qDebug() << "starting monerod " + program;
|
||||
|
||||
//
|
||||
QString process;
|
||||
#ifdef Q_OS_WIN
|
||||
process = QApplication::applicationDirPath() + "/monerod.exe";
|
||||
#elif defined(Q_OS_UNIX)
|
||||
process = QApplication::applicationDirPath() + "/monerod";
|
||||
#endif
|
||||
|
||||
if(process.length() == 0) {
|
||||
qDebug() << "no daemon binary defined for current platform";
|
||||
return false;
|
||||
}
|
||||
|
||||
qDebug() << "starting monerod " + process;
|
||||
|
||||
// TODO: forward CLI arguments
|
||||
QStringList arguments;
|
||||
|
||||
m_daemon = new QProcess();
|
||||
|
||||
// Connect output slots
|
||||
connect (m_daemon, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
|
||||
connect (m_daemon, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
|
||||
|
||||
|
||||
m_daemon->start(program);
|
||||
m_daemon->start(process);
|
||||
bool started = m_daemon->waitForStarted();
|
||||
|
||||
if(!started){
|
||||
|
@ -48,8 +64,8 @@ bool DaemonManager::stop()
|
|||
if(m_daemon){
|
||||
qDebug() << "stopping daemon";
|
||||
m_daemon->terminate();
|
||||
// Wait until stopped. Max 30 seconds
|
||||
bool stopped = m_daemon->waitForFinished(30000);
|
||||
// Wait until stopped. Max 10 seconds
|
||||
bool stopped = m_daemon->waitForFinished(10000);
|
||||
if(stopped) emit daemonStopped();
|
||||
return stopped;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue