Manages the execution of an external process with a timeout.
More...
#include <process_runner.hpp>
|
void | finished (int exitCode, QProcess::ExitStatus exitStatus) |
| Signal emitted when the process finishes. More...
|
|
void | outputReady (const QString &output) |
| Signal emitted when the process produces output. More...
|
|
void | errorReady (const QString &error) |
| Signal emitted when the process produces an error. More...
|
|
void | timeout () |
| Signal emitted when the process times out. More...
|
|
Manages the execution of an external process with a timeout.
The ProcessRunner class is responsible for starting an external process, capturing its output and errors, and enforcing a timeout for its execution.
◆ ProcessRunner()
ProcessRunner::ProcessRunner |
( |
const QString & |
program, |
|
|
const QStringList & |
arguments, |
|
|
int |
timeoutSeconds, |
|
|
QObject * |
parent = nullptr , |
|
|
QString |
processName = "process" |
|
) |
| |
Constructs a ProcessRunner object.
- Parameters
-
program | The program to be executed. |
arguments | The arguments to be passed to the program. |
timeoutSeconds | The timeout for the process execution in seconds. |
parent | Pointer to the parent QObject. |
processName | The name of the process (for logging purposes). |
◆ errorReady
void ProcessRunner::errorReady |
( |
const QString & |
error | ) |
|
|
signal |
Signal emitted when the process produces an error.
- Parameters
-
error | The error produced by the process. |
◆ finished
void ProcessRunner::finished |
( |
int |
exitCode, |
|
|
QProcess::ExitStatus |
exitStatus |
|
) |
| |
|
signal |
Signal emitted when the process finishes.
- Parameters
-
exitCode | The exit code of the process. |
exitStatus | The exit status of the process. |
◆ forceStop
void ProcessRunner::forceStop |
( |
| ) |
|
|
slot |
Forces the stop of the running process.
◆ outputReady
void ProcessRunner::outputReady |
( |
const QString & |
output | ) |
|
|
signal |
Signal emitted when the process produces output.
- Parameters
-
output | The output produced by the process. |
◆ start()
void ProcessRunner::start |
( |
| ) |
|
Starts the execution of the process.
◆ timeout
void ProcessRunner::timeout |
( |
| ) |
|
|
signal |
Signal emitted when the process times out.
The documentation for this class was generated from the following files: