mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-23 03:59:29 +00:00
refactor: remove childproc
This commit is contained in:
parent
0abd323bbb
commit
5f8eb1cb80
8 changed files with 5 additions and 63 deletions
|
@ -39,9 +39,6 @@ if(DEBUG)
|
||||||
set(CMAKE_VERBOSE_MAKEFILE ON)
|
set(CMAKE_VERBOSE_MAKEFILE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
check_include_file(sys/prctl.h HAVE_SYS_PRCTL_H)
|
|
||||||
check_symbol_exists(prctl "sys/prctl.h" HAVE_PRCTL)
|
|
||||||
|
|
||||||
# Monero configuration
|
# Monero configuration
|
||||||
set(BUILD_GUI_DEPS ON)
|
set(BUILD_GUI_DEPS ON)
|
||||||
set(BUILD_64 ON)
|
set(BUILD_64 ON)
|
||||||
|
|
|
@ -195,10 +195,6 @@ if(STACK_TRACE)
|
||||||
target_compile_definitions(feather PRIVATE STACK_TRACE=1)
|
target_compile_definitions(feather PRIVATE STACK_TRACE=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(HAVE_SYS_PRCTL_H)
|
|
||||||
target_compile_definitions(feather PRIVATE HAVE_SYS_PRCTL_H=1)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(STATIC)
|
if(STATIC)
|
||||||
target_compile_definitions(feather PRIVATE STATIC=1)
|
target_compile_definitions(feather PRIVATE STATIC=1)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
XmRig::XmRig(const QString &configDir, QObject *parent)
|
XmRig::XmRig(const QString &configDir, QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_process(new ChildProcess(this))
|
, m_process(new QProcess(this))
|
||||||
{
|
{
|
||||||
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
m_process->setProcessChannelMode(QProcess::MergedChannels);
|
||||||
connect(m_process, &QProcess::readyReadStandardOutput, this, &XmRig::handleProcessOutput);
|
connect(m_process, &QProcess::readyReadStandardOutput, this, &XmRig::handleProcessOutput);
|
||||||
|
|
|
@ -4,15 +4,7 @@
|
||||||
#ifndef FEATHER_XMRIG_H
|
#ifndef FEATHER_XMRIG_H
|
||||||
#define FEATHER_XMRIG_H
|
#define FEATHER_XMRIG_H
|
||||||
|
|
||||||
#include <cstdio>
|
#include <QProcess>
|
||||||
#include <cstdlib>
|
|
||||||
#include <iostream>
|
|
||||||
#include <QRegularExpression>
|
|
||||||
#include <QtNetwork>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
#include "utils/childproc.h"
|
|
||||||
|
|
||||||
class XmRig : public QObject
|
class XmRig : public QObject
|
||||||
{
|
{
|
||||||
|
@ -36,7 +28,7 @@ private slots:
|
||||||
void handleProcessError(QProcess::ProcessError error);
|
void handleProcessError(QProcess::ProcessError error);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ChildProcess *m_process;
|
QProcess *m_process;
|
||||||
QProcess m_killProcess;
|
QProcess m_killProcess;
|
||||||
bool m_elevated;
|
bool m_elevated;
|
||||||
};
|
};
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
TorManager::TorManager(QObject *parent)
|
TorManager::TorManager(QObject *parent)
|
||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
, m_checkConnectionTimer(new QTimer(this))
|
, m_checkConnectionTimer(new QTimer(this))
|
||||||
, m_process(new ChildProcess(this))
|
, m_process(new QProcess(this))
|
||||||
{
|
{
|
||||||
connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
|
connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
#include "utils/childproc.h"
|
|
||||||
#include "utils/SemanticVersion.h"
|
#include "utils/SemanticVersion.h"
|
||||||
|
|
||||||
class TorManager : public QObject
|
class TorManager : public QObject
|
||||||
|
@ -60,7 +59,7 @@ private:
|
||||||
|
|
||||||
static QPointer<TorManager> m_instance;
|
static QPointer<TorManager> m_instance;
|
||||||
|
|
||||||
ChildProcess *m_process;
|
QProcess *m_process;
|
||||||
int m_restarts = 0;
|
int m_restarts = 0;
|
||||||
bool m_stopRetries = false;
|
bool m_stopRetries = false;
|
||||||
bool m_localTor;
|
bool m_localTor;
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
// SPDX-FileCopyrightText: 2020-2023 The Monero Project
|
|
||||||
|
|
||||||
#include "utils/childproc.h"
|
|
||||||
|
|
||||||
ChildProcess::ChildProcess(QObject* parent) {}
|
|
||||||
ChildProcess::~ChildProcess() {}
|
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void ChildProcess::setupChildProcess() {
|
|
||||||
#if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX)
|
|
||||||
// https://smackerelofopinion.blogspot.com/2015/11/using-prsetpdeathsig-to-reap-child.html
|
|
||||||
::prctl(PR_SET_PDEATHSIG, SIGKILL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
|
@ -1,26 +0,0 @@
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
|
||||||
// SPDX-FileCopyrightText: 2020-2023 The Monero Project
|
|
||||||
|
|
||||||
#ifndef FEATHER_FPROCESS_H
|
|
||||||
#define FEATHER_FPROCESS_H
|
|
||||||
|
|
||||||
#include <QProcess>
|
|
||||||
|
|
||||||
#if defined(HAVE_SYS_PRCTL_H) && defined(Q_OS_UNIX)
|
|
||||||
#include <signal.h>
|
|
||||||
#include <sys/prctl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
class ChildProcess : public QProcess {
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit ChildProcess(QObject *parent);
|
|
||||||
~ChildProcess() override;
|
|
||||||
protected:
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
void setupChildProcess() override;
|
|
||||||
#endif
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif //FEATHER_FPROCESS_H
|
|
Loading…
Reference in a new issue