Utils: Use std::function instead of signal SynchronousProcess callback

Simpler interface and use.

Change-Id: I8db448b7ccd12927b8f8fd347b0a92c3f76f7114
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2021-05-06 08:56:42 +02:00
parent 3229903e8a
commit d825805c39
6 changed files with 31 additions and 85 deletions

View File

@@ -407,9 +407,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const CommandLine &cmd,
if (d->m_flags & MergeOutputChannels) {
process.setProcessChannelMode(QProcess::MergedChannels);
} else if (d->m_progressiveOutput || !(d->m_flags & SuppressStdErr)) {
process.setStdErrBufferedSignalsEnabled(true);
connect(&process, &SynchronousProcess::stdErrBuffered,
this, [this, proxy](const QString &text) {
process.setStdErrCallback([this, proxy](const QString &text) {
if (d->m_progressParser)
d->m_progressParser->parseProgress(text);
if (!(d->m_flags & SuppressStdErr))
@@ -421,9 +419,7 @@ SynchronousProcessResponse ShellCommand::runSynchronous(const CommandLine &cmd,
// connect stdout to the output window if desired
if (d->m_progressParser || d->m_progressiveOutput || (d->m_flags & ShowStdOut)) {
process.setStdOutBufferedSignalsEnabled(true);
connect(&process, &SynchronousProcess::stdOutBuffered,
this, [this, proxy](const QString &text) {
process.setStdOutCallback([this, proxy](const QString &text) {
if (d->m_progressParser)
d->m_progressParser->parseProgress(text);
if (d->m_flags & ShowStdOut)