diff --git a/src/libcalamares/utils/Runner.cpp b/src/libcalamares/utils/Runner.cpp new file mode 100644 index 000000000..0b0fed9ae --- /dev/null +++ b/src/libcalamares/utils/Runner.cpp @@ -0,0 +1,38 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * SPDX-License-Identifier: GPL-3.0-or-later + * + * Calamares is Free Software: see the License-Identifier above. + * + * + */ + +#include "Runner.h" + +namespace +{ +} + +namespace Calamares +{ +namespace Utils +{ + +struct Runner::Private +{ + QStringList m_command; +}; + +Runner::Runner() {} +Runner::Runner( const QStringList& command ) + : d( std::make_unique< Private >() ) +{ + d->m_command = command; +} + +Runner::~Runner() {} + + +} // namespace Utils +} // namespace Calamares diff --git a/src/libcalamares/utils/Runner.h b/src/libcalamares/utils/Runner.h new file mode 100644 index 000000000..08fa45a5c --- /dev/null +++ b/src/libcalamares/utils/Runner.h @@ -0,0 +1,54 @@ +/* === This file is part of Calamares - === + * + * SPDX-FileCopyrightText: 2021 Adriaan de Groot + * 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" + +#include +#include + +#include +#include +#include + +namespace Calamares +{ +namespace Utils +{ + +using RunLocation = CalamaresUtils::System::RunLocation; + +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 ); + // TODO: maybe with QDir as well? + Runner& setTimeout( std::chrono::seconds timeout ); + Runner& setInput( const QString& stdin ); + +private: + struct Private; + std::unique_ptr< Private > d; +}; + +} // namespace Utils +} // namespace Calamares + +#endif