| 48 | }; |
| 49 | |
| 50 | CommandExecutor::CommandExecutor(const QString& command, QObject* parent) |
| 51 | : QObject(parent) |
| 52 | , d_ptr(new CommandExecutorPrivate(this)) |
| 53 | { |
| 54 | Q_D(CommandExecutor); |
| 55 | |
| 56 | d->m_process = new KProcess(this); |
| 57 | d->m_process->setOutputChannelMode(KProcess::SeparateChannels); |
| 58 | d->m_lineMaker = new ProcessLineMaker(d->m_process); |
| 59 | d->m_command = command; |
| 60 | connect(d->m_lineMaker, &ProcessLineMaker::receivedStdoutLines, |
| 61 | this, &CommandExecutor::receivedStandardOutput); |
| 62 | connect(d->m_lineMaker, &ProcessLineMaker::receivedStderrLines, |
| 63 | this, &CommandExecutor::receivedStandardError); |
| 64 | connect(d->m_process, &QProcess::errorOccurred, |
| 65 | this, [this](QProcess::ProcessError error) { |
| 66 | Q_D(CommandExecutor); |
| 67 | d->procError(error); |
| 68 | }); |
| 69 | connect(d->m_process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), |
| 70 | this, [this](int code, QProcess::ExitStatus status) { |
| 71 | Q_D(CommandExecutor); |
| 72 | d->procFinished(code, status); |
| 73 | }); |
| 74 | } |
| 75 | |
| 76 | CommandExecutor::~CommandExecutor() |
| 77 | { |
nothing calls this directly
no test coverage detected