forked from qt-creator/qt-creator
Tests: Port manual/process to QtcProcess
Change-Id: I50d489e47f61927745f63b37dae3e3567355414f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -25,7 +25,8 @@
|
|||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
#include <utils/synchronousprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
@@ -47,15 +48,16 @@ static int testSynchronous(const QString &cmd, const QStringList &args)
|
|||||||
{
|
{
|
||||||
std::fprintf(stdout, "testSynchronous %s %s\n", qPrintable(cmd),
|
std::fprintf(stdout, "testSynchronous %s %s\n", qPrintable(cmd),
|
||||||
qPrintable(args.join(QLatin1Char(' '))));
|
qPrintable(args.join(QLatin1Char(' '))));
|
||||||
QProcess p;
|
Utils::QtcProcess p;
|
||||||
p.start(cmd, args);
|
p.setCommand({cmd, args});
|
||||||
|
p.start();
|
||||||
if (!p.waitForStarted())
|
if (!p.waitForStarted())
|
||||||
return -2;
|
return -2;
|
||||||
p.closeWriteChannel();
|
p.closeWriteChannel();
|
||||||
|
|
||||||
QByteArray stdOut;
|
QByteArray stdOut;
|
||||||
QByteArray stdErr;
|
QByteArray stdErr;
|
||||||
if (!Utils::SynchronousProcess::readDataFromProcess(p, 2, &stdOut, &stdErr)) {
|
if (!p.readDataFromProcess(2, &stdOut, &stdErr, false)) {
|
||||||
std::fputs("Timeout", stderr);
|
std::fputs("Timeout", stderr);
|
||||||
return -3;
|
return -3;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user