QProcess/Unix: improve the error message if the child modifier throws
Functionality added for 6.5, but after translatable string freeze. Change-Id: Icfe44ecf285a480fafe4fffd174d984c5349e0cb Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
ba05af82d3
commit
fb40737b0d
@ -673,8 +673,12 @@ bool QProcessPrivate::processStarted(QString *errorMessage)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// did we read an error message?
|
// did we read an error message?
|
||||||
if (errorMessage)
|
if (errorMessage) {
|
||||||
|
if (buf.code == FakeErrnoForThrow)
|
||||||
|
*errorMessage = QProcess::tr("childProcessModifier() function threw an exception");
|
||||||
|
else
|
||||||
*errorMessage = QLatin1StringView(buf.function) + ": "_L1 + qt_error_string(buf.code);
|
*errorMessage = QLatin1StringView(buf.function) + ": "_L1 + qt_error_string(buf.code);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1486,7 +1486,7 @@ void tst_QProcess::throwInChildProcessModifier()
|
|||||||
QVERIFY(!process.waitForStarted(5000));
|
QVERIFY(!process.waitForStarted(5000));
|
||||||
QCOMPARE(process.state(), QProcess::NotRunning);
|
QCOMPARE(process.state(), QProcess::NotRunning);
|
||||||
QCOMPARE(process.error(), QProcess::FailedToStart);
|
QCOMPARE(process.error(), QProcess::FailedToStart);
|
||||||
QVERIFY2(process.errorString().contains("throw"),
|
QVERIFY2(process.errorString().contains("childProcessModifier"),
|
||||||
qPrintable(process.errorString()));
|
qPrintable(process.errorString()));
|
||||||
|
|
||||||
// try again, to ensure QProcess internal state wasn't corrupted
|
// try again, to ensure QProcess internal state wasn't corrupted
|
||||||
@ -1494,7 +1494,7 @@ void tst_QProcess::throwInChildProcessModifier()
|
|||||||
QVERIFY(!process.waitForStarted(5000));
|
QVERIFY(!process.waitForStarted(5000));
|
||||||
QCOMPARE(process.state(), QProcess::NotRunning);
|
QCOMPARE(process.state(), QProcess::NotRunning);
|
||||||
QCOMPARE(process.error(), QProcess::FailedToStart);
|
QCOMPARE(process.error(), QProcess::FailedToStart);
|
||||||
QVERIFY2(process.errorString().contains("throw"),
|
QVERIFY2(process.errorString().contains("childProcessModifier"),
|
||||||
qPrintable(process.errorString()));
|
qPrintable(process.errorString()));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user