summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/io/qprocess.cpp153
-rw-r--r--src/corelib/io/qprocess.h37
-rw-r--r--tests/auto/corelib/io/qprocess/tst_qprocess.cpp187
-rw-r--r--tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp4
-rw-r--r--tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp8
5 files changed, 16 insertions, 373 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp
index 7182eb2a26..374142702b 100644
--- a/src/corelib/io/qprocess.cpp
+++ b/src/corelib/io/qprocess.cpp
@@ -107,21 +107,6 @@ QT_END_NAMESPACE
QT_BEGIN_NAMESPACE
/*!
- \since 5.6
-
- \macro QT_NO_PROCESS_COMBINED_ARGUMENT_START
- \relates QProcess
-
- Disables the
- \l {QProcess::start(const QString &, QIODevice::OpenMode)}
- {QProcess::start}() overload taking a single string.
- In most cases where it is used, the user intends for the first argument
- to be treated atomically as per the other overload.
-
- \sa QProcess::start(const QString &command, QIODevice::OpenMode mode)
-*/
-
-/*!
\class QProcessEnvironment
\inmodule QtCore
@@ -984,12 +969,6 @@ void QProcessPrivate::setErrorAndEmit(QProcess::ProcessError error, const QStrin
Q_ASSERT(error != QProcess::UnknownError);
setError(error, description);
emit q->errorOccurred(processError);
-#if QT_DEPRECATED_SINCE(5, 6)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->error(processError);
-QT_WARNING_POP
-#endif
}
/*!
@@ -1256,32 +1235,6 @@ QProcess::~QProcess()
d->cleanup();
}
-#if QT_DEPRECATED_SINCE(5, 13)
-/*!
- \obsolete
- Returns the read channel mode of the QProcess. This function is
- equivalent to processChannelMode()
-
- \sa processChannelMode()
-*/
-QProcess::ProcessChannelMode QProcess::readChannelMode() const
-{
- return processChannelMode();
-}
-
-/*!
- \obsolete
-
- Use setProcessChannelMode(\a mode) instead.
-
- \sa setProcessChannelMode()
-*/
-void QProcess::setReadChannelMode(ProcessChannelMode mode)
-{
- setProcessChannelMode(mode);
-}
-#endif
-
/*!
\since 4.2
@@ -2252,63 +2205,6 @@ QStringList QProcess::splitCommand(QStringView command)
}
/*!
- \obsolete
- \overload
-
- Starts the command \a command in a new process.
- The OpenMode is set to \a mode.
-
- \a command is a single string of text containing both the program name
- and its arguments. The arguments are separated by one or more spaces.
- For example:
-
- \snippet code/src_corelib_io_qprocess.cpp 5
-
- Arguments containing spaces must be quoted to be correctly supplied to
- the new process. For example:
-
- \snippet code/src_corelib_io_qprocess.cpp 6
-
- Literal quotes in the \a command string are represented by triple quotes.
- For example:
-
- \snippet code/src_corelib_io_qprocess.cpp 7
-
- After the \a command string has been split and unquoted, this function
- behaves like the overload which takes the arguments as a string list.
-
- You can disable this overload by defining \c
- QT_NO_PROCESS_COMBINED_ARGUMENT_START when you compile your applications.
- This can be useful if you want to ensure that you are not splitting arguments
- unintentionally, for example. In virtually all cases, using the other overload
- is the preferred method.
-
- On operating systems where the system API for passing command line
- arguments to a subprocess natively uses a single string (Windows), one can
- conceive command lines which cannot be passed via QProcess's portable
- list-based API. In these rare cases you need to use setProgram() and
- setNativeArguments() instead of this function.
-
- \sa splitCommand()
-
-*/
-#if !defined(QT_NO_PROCESS_COMBINED_ARGUMENT_START)
-void QProcess::start(const QString &command, OpenMode mode)
-{
- QStringList args = splitCommand(command);
- if (args.isEmpty()) {
- Q_D(QProcess);
- d->setErrorAndEmit(QProcess::FailedToStart, tr("No program defined"));
- return;
- }
-
- const QString prog = args.takeFirst();
-
- start(prog, args, mode);
-}
-#endif
-
-/*!
\since 5.0
Returns the program the process was last started with.
@@ -2460,29 +2356,6 @@ int QProcess::execute(const QString &program, const QStringList &arguments)
}
/*!
- \obsolete
- \overload
-
- Starts the program \a command in a new process, waits for it to finish,
- and then returns the exit code.
-
- Argument handling is identical to the respective start() overload.
-
- After the \a command string has been split and unquoted, this function
- behaves like the overload which takes the arguments as a string list.
-
- \sa start(), splitCommand()
-*/
-int QProcess::execute(const QString &command)
-{
- QStringList args = splitCommand(command);
- if (args.isEmpty())
- return -2;
- QString program = args.takeFirst();
- return execute(program, args);
-}
-
-/*!
\overload startDetached()
Starts the program \a program with the arguments \a arguments in a
@@ -2513,32 +2386,6 @@ bool QProcess::startDetached(const QString &program,
return process.startDetached(pid);
}
-/*!
- \obsolete
- \overload startDetached()
-
- Starts the command \a command in a new process, and detaches from it.
- Returns \c true on success; otherwise returns \c false.
-
- Argument handling is identical to the respective start() overload.
-
- After the \a command string has been split and unquoted, this function
- behaves like the overload which takes the arguments as a string list.
-
- \sa start(const QString &command, QIODevice::OpenMode mode), splitCommand()
-*/
-bool QProcess::startDetached(const QString &command)
-{
- QStringList args = splitCommand(command);
- if (args.isEmpty())
- return false;
-
- QProcess process;
- process.setProgram(args.takeFirst());
- process.setArguments(args);
- return process.startDetached();
-}
-
QT_BEGIN_INCLUDE_NAMESPACE
#if defined(Q_OS_MACX)
# include <crt_externs.h>
diff --git a/src/corelib/io/qprocess.h b/src/corelib/io/qprocess.h
index ee83c93cf8..f43dfad840 100644
--- a/src/corelib/io/qprocess.h
+++ b/src/corelib/io/qprocess.h
@@ -158,16 +158,7 @@ public:
explicit QProcess(QObject *parent = nullptr);
virtual ~QProcess();
- void start(const QString &program, const QStringList &arguments, OpenMode mode = ReadWrite);
-#if !defined(QT_NO_PROCESS_COMBINED_ARGUMENT_START)
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X(
- "Use QProcess::start(const QString &program, const QStringList &arguments,"
- "OpenMode mode = ReadWrite) instead"
- )
- void start(const QString &command, OpenMode mode = ReadWrite);
-#endif
-#endif
+ void start(const QString &program, const QStringList &arguments = {}, OpenMode mode = ReadWrite);
void start(OpenMode mode = ReadWrite);
bool startDetached(qint64 *pid = nullptr);
bool open(OpenMode mode = ReadWrite) override;
@@ -178,12 +169,6 @@ public:
QStringList arguments() const;
void setArguments(const QStringList & arguments);
-#if QT_DEPRECATED_SINCE(5, 13)
- QT_DEPRECATED_X("Use QProcess::processChannelMode() instead")
- ProcessChannelMode readChannelMode() const;
- QT_DEPRECATED_X("Use QProcess::setProcessChannelMode() instead")
- void setReadChannelMode(ProcessChannelMode mode);
-#endif
ProcessChannelMode processChannelMode() const;
void setProcessChannelMode(ProcessChannelMode mode);
InputChannelMode inputChannelMode() const;
@@ -252,21 +237,9 @@ public:
bool isSequential() const override;
void close() override;
- static int execute(const QString &program, const QStringList &arguments);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X(
- "Use QProcess::execute(const QString &program, const QStringList &arguments) instead"
- )
- static int execute(const QString &command);
-#endif
- static bool startDetached(const QString &program, const QStringList &arguments,
+ static int execute(const QString &program, const QStringList &arguments = {});
+ static bool startDetached(const QString &program, const QStringList &arguments = {},
const QString &workingDirectory = QString(), qint64 *pid = nullptr);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_X(
- "Use QProcess::startDetached(const QString &program, const QStringList &arguments) instead"
- )
- static bool startDetached(const QString &command);
-#endif
static QStringList systemEnvironment();
@@ -281,10 +254,6 @@ public Q_SLOTS:
Q_SIGNALS:
void started(QPrivateSignal);
void finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit);
-#if QT_DEPRECATED_SINCE(5, 6)
- QT_DEPRECATED_X("Use QProcess::errorOccurred(QProcess::ProcessError) instead")
- void error(QProcess::ProcessError error);
-#endif
void errorOccurred(QProcess::ProcessError error);
void stateChanged(QProcess::ProcessState state, QPrivateSignal);
diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
index 7cd99326ff..f0316de945 100644
--- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
+++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp
@@ -156,12 +156,6 @@ private slots:
void failToStartEmptyArgs_data();
void failToStartEmptyArgs();
-#if QT_DEPRECATED_SINCE(5, 13)
- void restartProcessDeadlock_deprecated();
- void waitForReadyReadInAReadyReadSlot_deprecated();
- void finishProcessBeforeReadingDone_deprecated();
-#endif
-
protected slots:
void readFromProcess();
void exitLoopSlot();
@@ -198,14 +192,6 @@ void tst_QProcess::getSetCheck()
QProcess obj1;
// ProcessChannelMode QProcess::readChannelMode()
// void QProcess::setProcessChannelMode(ProcessChannelMode)
-#if QT_DEPRECATED_SINCE(5, 13)
- obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels));
- QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.readChannelMode());
- obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels));
- QCOMPARE(QProcess::ProcessChannelMode(QProcess::MergedChannels), obj1.readChannelMode());
- obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::ForwardedChannels));
- QCOMPARE(QProcess::ProcessChannelMode(QProcess::ForwardedChannels), obj1.readChannelMode());
-#endif
obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::SeparateChannels));
QCOMPARE(QProcess::ProcessChannelMode(QProcess::SeparateChannels), obj1.processChannelMode());
obj1.setProcessChannelMode(QProcess::ProcessChannelMode(QProcess::MergedChannels));
@@ -403,11 +389,6 @@ void tst_QProcess::crashTest()
QVERIFY(spy.isValid());
QVERIFY(spy2.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy spy3(process.data(), static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(spy3.isValid());
-#endif
-
QVERIFY(process->waitForFinished(30000));
QCOMPARE(spy.count(), 1);
@@ -416,11 +397,6 @@ void tst_QProcess::crashTest()
QCOMPARE(spy2.count(), 1);
QCOMPARE(*static_cast<const QProcess::ExitStatus *>(spy2.at(0).at(1).constData()), QProcess::CrashExit);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(spy3.count(), 1);
- QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy3.at(0).at(0).constData()), QProcess::Crashed);
-#endif
-
QCOMPARE(process->exitStatus(), QProcess::CrashExit);
// delete process;
@@ -713,10 +689,6 @@ void tst_QProcess::readTimeoutAndThenCrash()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(&process, &QProcess::errorOccurred);
QVERIFY(spy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy spy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(spy2.isValid());
-#endif
process.kill();
@@ -725,10 +697,6 @@ void tst_QProcess::readTimeoutAndThenCrash()
QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(spy2.count(), 1);
- QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy2.at(0).at(0).constData()), QProcess::Crashed);
-#endif
}
void tst_QProcess::waitForFinished()
@@ -1416,6 +1384,9 @@ void tst_QProcess::spaceArgsTest()
QFETCH(QStringList, args);
QFETCH(QString, stringArgs);
+ auto splitString = QProcess::splitCommand(stringArgs);
+ QCOMPARE(args, splitString);
+
QStringList programs;
programs << QString::fromLatin1("testProcessSpacesArgs/nospace")
<< QString::fromLatin1("testProcessSpacesArgs/one space")
@@ -1442,28 +1413,6 @@ void tst_QProcess::spaceArgsTest()
actual.removeFirst();
QCOMPARE(actual, args);
-
- if (program.contains(QLatin1Char(' ')))
- program = QLatin1Char('"') + program + QLatin1Char('"');
-
- if (!stringArgs.isEmpty())
- program += QLatin1Char(' ') + stringArgs;
-
- errorMessage.clear();
- process.start(program);
- started = process.waitForStarted(5000);
- if (!started)
- errorMessage = startFailMessage(program, process);
-
- QVERIFY2(started, errorMessage.constData());
- QVERIFY(process.waitForFinished(5000));
-
- actual = QString::fromLatin1(process.readAll()).split("|");
- QVERIFY(!actual.isEmpty());
- // not interested in the program name, it might be different.
- actual.removeFirst();
-
- QCOMPARE(actual, args);
}
}
@@ -1518,7 +1467,7 @@ void tst_QProcess::exitCodeTest()
{
for (int i = 0; i < 255; ++i) {
QProcess process;
- process.start("testExitCodes/testExitCodes " + QString::number(i));
+ process.start("testExitCodes/testExitCodes", {QString::number(i)});
QVERIFY(process.waitForFinished(5000));
QCOMPARE(process.exitCode(), i);
QCOMPARE(process.error(), QProcess::UnknownError);
@@ -1539,11 +1488,6 @@ void tst_QProcess::failToStart()
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(errorSpy2.isValid());
-#endif
-
// OS X and HP-UX have a really low default process limit (~100), so spawning
// to many processes here will cause test failures later on.
#if defined Q_OS_HPUX
@@ -1557,9 +1501,6 @@ void tst_QProcess::failToStart()
for (int j = 0; j < 8; ++j) {
for (int i = 0; i < attempts; ++i) {
QCOMPARE(errorSpy.count(), j * attempts + i);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), j * attempts + i);
-#endif
process.start("/blurp");
switch (j) {
@@ -1585,9 +1526,6 @@ void tst_QProcess::failToStart()
QCOMPARE(process.error(), QProcess::FailedToStart);
QCOMPARE(errorSpy.count(), j * attempts + i + 1);
QCOMPARE(finishedSpy.count(), 0);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), j * attempts + i + 1);
-#endif
int it = j * attempts + i + 1;
@@ -1610,11 +1548,6 @@ void tst_QProcess::failToStartWithWait()
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(errorSpy2.isValid());
-#endif
-
for (int i = 0; i < 50; ++i) {
process.start("/blurp", QStringList() << "-v" << "-debug");
process.waitForStarted();
@@ -1622,9 +1555,6 @@ void tst_QProcess::failToStartWithWait()
QCOMPARE(process.error(), QProcess::FailedToStart);
QCOMPARE(errorSpy.count(), i + 1);
QCOMPARE(finishedSpy.count(), 0);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), i + 1);
-#endif
}
}
@@ -1640,11 +1570,6 @@ void tst_QProcess::failToStartWithEventLoop()
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(errorSpy2.isValid());
-#endif
-
// The error signal may be emitted before start() returns
connect(&process, &QProcess::errorOccurred, &loop, &QEventLoop::quit, Qt::QueuedConnection);
@@ -1657,9 +1582,6 @@ void tst_QProcess::failToStartWithEventLoop()
QCOMPARE(process.error(), QProcess::FailedToStart);
QCOMPARE(errorSpy.count(), i + 1);
QCOMPARE(finishedSpy.count(), 0);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), i + 1);
-#endif
}
}
@@ -1667,8 +1589,7 @@ void tst_QProcess::failToStartEmptyArgs_data()
{
QTest::addColumn<int>("startOverload");
QTest::newRow("start(QString, QStringList, OpenMode)") << 0;
- QTest::newRow("start(QString, OpenMode)") << 1;
- QTest::newRow("start(OpenMode)") << 2;
+ QTest::newRow("start(OpenMode)") << 1;
}
void tst_QProcess::failToStartEmptyArgs()
@@ -1679,19 +1600,12 @@ void tst_QProcess::failToStartEmptyArgs()
QProcess process;
QSignalSpy errorSpy(&process, static_cast<QProcessErrorSignal>(&QProcess::errorOccurred));
QVERIFY(errorSpy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(errorSpy2.isValid());
-#endif
switch (startOverload) {
case 0:
process.start(QString(), QStringList(), QIODevice::ReadWrite);
break;
case 1:
- process.start(QString(), QIODevice::ReadWrite);
- break;
- case 2:
process.start(QIODevice::ReadWrite);
break;
default:
@@ -1700,9 +1614,6 @@ void tst_QProcess::failToStartEmptyArgs()
QVERIFY(!process.waitForStarted());
QCOMPARE(errorSpy.count(), 1);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), 1);
-#endif
QCOMPARE(process.error(), QProcess::FailedToStart);
}
@@ -1938,21 +1849,12 @@ void tst_QProcess::waitForReadyReadForNonexistantProcess()
QVERIFY(errorSpy.isValid());
QVERIFY(finishedSpy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy errorSpy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(errorSpy2.isValid());
-#endif
-
QVERIFY(!process.waitForReadyRead()); // used to crash
process.start("doesntexist");
QVERIFY(!process.waitForReadyRead());
QCOMPARE(errorSpy.count(), 1);
QCOMPARE(errorSpy.at(0).at(0).toInt(), 0);
QCOMPARE(finishedSpy.count(), 0);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(errorSpy2.count(), 1);
- QCOMPARE(errorSpy2.at(0).at(0).toInt(), 0);
-#endif
}
void tst_QProcess::setStandardInputFile()
@@ -2162,7 +2064,7 @@ void tst_QProcess::fileWriterProcess()
QVERIFY(QFile::remove(fileName));
QProcess process;
process.setWorkingDirectory(m_temporaryDir.path());
- process.start(binary, QIODevice::ReadWrite | QIODevice::Text);
+ process.start(binary, {}, QIODevice::ReadWrite | QIODevice::Text);
process.write(stdinStr);
process.closeWriteChannel();
while (process.bytesToWrite()) {
@@ -2373,7 +2275,6 @@ void tst_QProcess::invalidProgramString_data()
QTest::addColumn<QString>("programString");
QTest::newRow("null string") << QString();
QTest::newRow("empty string") << QString("");
- QTest::newRow("only blank string") << QString(" ");
}
void tst_QProcess::invalidProgramString()
@@ -2384,17 +2285,10 @@ void tst_QProcess::invalidProgramString()
qRegisterMetaType<QProcess::ProcessError>("QProcess::ProcessError");
QSignalSpy spy(&process, &QProcess::errorOccurred);
QVERIFY(spy.isValid());
-#if QT_DEPRECATED_SINCE(5, 6)
- QSignalSpy spy2(&process, static_cast<QProcessErrorSignal>(&QProcess::error));
- QVERIFY(spy2.isValid());
-#endif
process.start(programString);
QCOMPARE(process.error(), QProcess::FailedToStart);
QCOMPARE(spy.count(), 1);
-#if QT_DEPRECATED_SINCE(5, 6)
- QCOMPARE(spy2.count(), 1);
-#endif
QVERIFY(!QProcess::startDetached(programString));
}
@@ -2544,7 +2438,7 @@ void tst_QProcess::startStopStartStopBuffers()
#endif
process.setProcessChannelMode(QProcess::ProcessChannelMode(channelMode2));
- process.start("testProcessEcho2/testProcessEcho2", QIODevice::ReadWrite | QIODevice::Text);
+ process.start("testProcessEcho2/testProcessEcho2", {}, QIODevice::ReadWrite | QIODevice::Text);
// the buffers should now be empty
QCOMPARE(process.bytesToWrite(), qint64(0));
@@ -2593,72 +2487,5 @@ void tst_QProcess::processEventsInAReadyReadSlot()
QVERIFY(process.waitForFinished());
}
-#if QT_DEPRECATED_SINCE(5, 13)
-
-void tst_QProcess::restartProcessDeadlock_deprecated()
-{
- // The purpose of this test is to detect whether restarting a
- // process in the finished() connected slot causes a deadlock
- // because of the way QProcessManager uses its locks.
- QProcess process;
- connect(&process, &QProcess::finished, this, &tst_QProcess::restartProcess);
-
- process.start("testProcessEcho/testProcessEcho");
-
- QCOMPARE(process.write("", 1), qlonglong(1));
- QVERIFY(process.waitForFinished(5000));
-
- QObject::disconnect(&process, &QProcess::finished, nullptr, nullptr);
-
- QCOMPARE(process.write("", 1), qlonglong(1));
- QVERIFY(process.waitForFinished(5000));
- QCOMPARE(process.exitStatus(), QProcess::NormalExit);
- QCOMPARE(process.exitCode(), 0);
-}
-
-void tst_QProcess::waitForReadyReadInAReadyReadSlot_deprecated()
-{
- QProcess process;
- connect(&process, &QIODevice::readyRead, this, &tst_QProcess::waitForReadyReadInAReadyReadSlotSlot);
- connect(&process, &QProcess::finished, this, &tst_QProcess::exitLoopSlot);
- bytesAvailable = 0;
-
- process.start("testProcessEcho/testProcessEcho");
- QVERIFY(process.waitForStarted(5000));
-
- QSignalSpy spy(&process, &QProcess::readyRead);
- QVERIFY(spy.isValid());
- process.write("foo");
- QTestEventLoop::instance().enterLoop(30);
- QVERIFY(!QTestEventLoop::instance().timeout());
-
- QCOMPARE(spy.count(), 1);
-
- process.disconnect();
- QVERIFY(process.waitForFinished(5000));
- QCOMPARE(process.exitStatus(), QProcess::NormalExit);
- QCOMPARE(process.exitCode(), 0);
- QVERIFY(process.bytesAvailable() > bytesAvailable);
-}
-
-void tst_QProcess::finishProcessBeforeReadingDone_deprecated()
-{
- QProcess process;
- BlockOnReadStdOut blocker(&process);
- QEventLoop loop;
- connect(&process, &QProcess::finished, &loop, &QEventLoop::quit);
- process.start("testProcessOutput/testProcessOutput");
- QVERIFY(process.waitForStarted());
- loop.exec();
- QStringList lines = QString::fromLocal8Bit(process.readAllStandardOutput()).split(
- QRegularExpression(QStringLiteral("[\r\n]")), Qt::SkipEmptyParts);
- QVERIFY(!lines.isEmpty());
- QCOMPARE(lines.last(), QStringLiteral("10239 -this is a number"));
- QCOMPARE(process.exitStatus(), QProcess::NormalExit);
- QCOMPARE(process.exitCode(), 0);
-}
-
-#endif
-
QTEST_MAIN(tst_QProcess)
#include "tst_qprocess.moc"
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
index ab2e2175ea..cef67d680b 100644
--- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
+++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp
@@ -1486,7 +1486,7 @@ void tst_QTextStream::readAllFromStdin()
QSKIP("No qprocess support", SkipAll);
#else
QProcess stdinProcess;
- stdinProcess.start("readAllStdinProcess/readAllStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
+ stdinProcess.start("readAllStdinProcess/readAllStdinProcess", {}, QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
QTextStream stream(&stdinProcess);
@@ -1507,7 +1507,7 @@ void tst_QTextStream::readLineFromStdin()
QSKIP("No qprocess support", SkipAll);
#else
QProcess stdinProcess;
- stdinProcess.start("readLineStdinProcess/readLineStdinProcess", QIODevice::ReadWrite | QIODevice::Text);
+ stdinProcess.start("readLineStdinProcess/readLineStdinProcess", {}, QIODevice::ReadWrite | QIODevice::Text);
stdinProcess.setReadChannel(QProcess::StandardError);
stdinProcess.write("abc\n");
diff --git a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
index 4c4113d9d4..b69bfb106c 100644
--- a/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
+++ b/tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp
@@ -1088,7 +1088,7 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
QSKIP("No qprocess support", SkipAll);
#else
QProcess serverProcess;
- serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
+ serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), {},
QIODevice::ReadWrite | QIODevice::Text);
const auto serverProcessCleaner = qScopeGuard([&serverProcess] {
@@ -1112,7 +1112,7 @@ void tst_QUdpSocket::outOfProcessConnectedClientServerTest()
QProcess clientProcess;
clientProcess.start(QString::fromLatin1("clientserver/clientserver connectedclient %1 %2")
- .arg(QLatin1String("127.0.0.1")).arg(serverPort),
+ .arg(QLatin1String("127.0.0.1")).arg(serverPort), {},
QIODevice::ReadWrite | QIODevice::Text);
const auto clientProcessCleaner = qScopeGuard([&clientProcess] {
@@ -1162,7 +1162,7 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
QSKIP("No qprocess support", SkipAll);
#else
QProcess serverProcess;
- serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"),
+ serverProcess.start(QLatin1String("clientserver/clientserver server 1 1"), {},
QIODevice::ReadWrite | QIODevice::Text);
const auto serverProcessCleaner = qScopeGuard([&serverProcess] {
@@ -1186,7 +1186,7 @@ void tst_QUdpSocket::outOfProcessUnconnectedClientServerTest()
QProcess clientProcess;
clientProcess.start(QString::fromLatin1("clientserver/clientserver unconnectedclient %1 %2")
- .arg(QLatin1String("127.0.0.1")).arg(serverPort),
+ .arg(QLatin1String("127.0.0.1")).arg(serverPort), {},
QIODevice::ReadWrite | QIODevice::Text);
const auto clientProcessCleaner = qScopeGuard([&clientProcess] {