From 64c47d7f61ff51762709d45e8e69fa90926dc6a3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 18 Feb 2021 09:36:56 -0800 Subject: QProcess::startDetached: set the error condition on failure to start And set *pid to -1. [ChangeLog][QtCore][QProcess] If a startDetached() fails to start the target application, the QProcess object should now have a proper error string in errorString(). Change-Id: Ic90d8429a0eb4837971dfffd1664e825ffcb923e Reviewed-by: Oswald Buddenhagen (cherry picked from commit 73a04edce151b21ea5d07494603c0317716e99d9) Reviewed-by: Qt Cherry-pick Bot --- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/auto/corelib') diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index e68fccf4be..432fdc2e59 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -2279,6 +2279,8 @@ void tst_QProcess::detachedSetNonExistentWorkingDirectory() qint64 pid = -1; QVERIFY(!process.startDetached(&pid)); QCOMPARE(pid, -1); + QCOMPARE(process.error(), QProcess::FailedToStart); + QVERIFY(process.errorString() != "Unknown error"); } void tst_QProcess::startFinishStartFinish() -- cgit v1.2.3