mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Refactor/Create APT/DNF Repository (#1648)
This commit is contained in:
@@ -1,93 +1,92 @@
|
||||
#ifdef _WIN32
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <utils/Logger.h>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
namespace Process {
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <utils/Logger.h>
|
||||
#include <QString>
|
||||
#include <QByteArray>
|
||||
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
namespace Process
|
||||
{
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
|
||||
{
|
||||
return QSTRING_CSTR(QString());
|
||||
}
|
||||
};
|
||||
QByteArray command_exec(const QString& /*cmd*/, const QByteArray& /*data*/)
|
||||
{
|
||||
return QSTRING_CSTR(QString());
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
#include <utils/Process.h>
|
||||
#include <utils/Logger.h>
|
||||
#include <utils/Process.h>
|
||||
#include <utils/Logger.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
#include <QCoreApplication>
|
||||
#include <QProcess>
|
||||
#include <QStringList>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <unistd.h>
|
||||
#include <cstdio>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <csignal>
|
||||
#include <csignal>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
#include <QDebug>
|
||||
#include <QMetaObject>
|
||||
|
||||
namespace Process {
|
||||
|
||||
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
std::cout << std::endl
|
||||
<< " *******************************************" << std::endl
|
||||
<< " * hyperion will restart now *" << std::endl
|
||||
<< " *******************************************" << std::endl << std::endl;
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
|
||||
{
|
||||
char buffer[128];
|
||||
QString result;
|
||||
|
||||
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
|
||||
if (pipe)
|
||||
namespace Process
|
||||
{
|
||||
while (!feof(pipe.get()))
|
||||
void restartHyperion(int exitCode)
|
||||
{
|
||||
if (fgets(buffer, 128, pipe.get()) != nullptr)
|
||||
result += buffer;
|
||||
}
|
||||
}
|
||||
return QSTRING_CSTR(result);
|
||||
}
|
||||
Logger* log = Logger::getInstance("Process");
|
||||
Info(log, "Restarting hyperion ...");
|
||||
|
||||
};
|
||||
std::cout << std::endl
|
||||
<< " *******************************************" << std::endl
|
||||
<< " * hyperion will restart now *" << std::endl
|
||||
<< " *******************************************" << std::endl << std::endl;
|
||||
|
||||
auto arguments = QCoreApplication::arguments();
|
||||
if (!arguments.contains("--wait-hyperion"))
|
||||
arguments << "--wait-hyperion";
|
||||
|
||||
QProcess::startDetached(QCoreApplication::applicationFilePath(), arguments);
|
||||
|
||||
//Exit with non-zero code to ensure service deamon restarts hyperion
|
||||
QCoreApplication::exit(exitCode);
|
||||
}
|
||||
|
||||
QByteArray command_exec(const QString& cmd, const QByteArray& /*data*/)
|
||||
{
|
||||
char buffer[128];
|
||||
QString result;
|
||||
|
||||
std::shared_ptr<FILE> pipe(popen(cmd.toLocal8Bit().constData(), "r"), pclose);
|
||||
if (pipe)
|
||||
{
|
||||
while (!feof(pipe.get()))
|
||||
{
|
||||
if (fgets(buffer, 128, pipe.get()) != nullptr)
|
||||
result += buffer;
|
||||
}
|
||||
}
|
||||
return QSTRING_CSTR(result);
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user