QProcess has quite extensive support for synchronous use.
#include <QCoreApplication>
#include <QDebug>
#include <QProcess>
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
QProcess process;
process.start("ls", {"-l"});
if (process.waitForFinished()) {
qDebug() << "returned:" << process.readAllStandardOutput();
} else {
qDebug() << process.errorString();
}
process.start("ls", {"-l"});
while (process.waitForReadyRead()) {
while (process.canReadLine())
qDebug() << process.readLine().trimmed();
}
}