2021-07-28 13:11:06 +02:00
|
|
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
|
|
|
*
|
|
|
|
* SPDX-FileCopyrightText: 2021 Adriaan de Groot <groot@kde.org>
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
*
|
|
|
|
* Calamares is Free Software: see the License-Identifier above.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef UTILS_RUNNER_H
|
|
|
|
#define UTILS_RUNNER_H
|
|
|
|
|
|
|
|
#include "CalamaresUtilsSystem.h"
|
|
|
|
|
2021-10-01 13:16:37 +02:00
|
|
|
#include <QDir>
|
2021-07-28 13:11:06 +02:00
|
|
|
#include <QObject>
|
|
|
|
#include <QStringList>
|
|
|
|
|
|
|
|
#include <chrono>
|
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
namespace Calamares
|
|
|
|
{
|
|
|
|
namespace Utils
|
|
|
|
{
|
|
|
|
|
|
|
|
using RunLocation = CalamaresUtils::System::RunLocation;
|
|
|
|
|
2021-10-01 13:16:37 +02:00
|
|
|
/** @brief A Runner wraps a process and handles running it and signalling */
|
2021-07-28 13:11:06 +02:00
|
|
|
class Runner : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
Runner();
|
|
|
|
Runner( const QStringList& command );
|
|
|
|
virtual ~Runner() override;
|
|
|
|
|
|
|
|
Runner& setCommand( const QStringList& command );
|
|
|
|
Runner& setLocation( RunLocation r );
|
|
|
|
Runner& setWorkingDirectory( const QString& directory );
|
2021-10-01 13:16:37 +02:00
|
|
|
Runner& setWorkingDirectory( const QDir& directory );
|
2021-07-28 13:11:06 +02:00
|
|
|
Runner& setTimeout( std::chrono::seconds timeout );
|
|
|
|
Runner& setInput( const QString& stdin );
|
|
|
|
|
|
|
|
private:
|
|
|
|
struct Private;
|
|
|
|
std::unique_ptr< Private > d;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Utils
|
|
|
|
} // namespace Calamares
|
|
|
|
|
|
|
|
#endif
|