Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.9
-
None
-
Windows
Description
On Windows when qmllint is run as a process it does not populate error channel when it discover some errors. It return code -1, and error channel is empty.
How to reproduce it:
QProcess process; process.setProcessChannelMode(QProcess::SeparateChannels); process.start("qmllint", {"PUT_PATH_TO_QML_FILE_WITH_ERRORS_HERE"}); if (!process.waitForFinished()) { process.kill(); qDebug() << "QMLLINT didn't finish"; } if (process.exitStatus() != QProcess::NormalExit) { qDebug() << "QMLLINT wrong exit"; } QString output = process.readAllStandardOutput(); QString error = process.readAllStandardError(); qDebug() << "QMLLINT qmllint output: " << output; qDebug() << "QMLLINT qmllint errors: " << error;
Replace "PUT_PATH_TO_QML_FILE_WITH_ERRORS_HERE" with path to this qml file:
import QtQuick 2.15 import QtQuick.Window 2.15Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Rectangle { id: rect width: 100 height: 100 color: "ble" MouseArea { anchors. + fill: pant onClicked: { console.log(rect.x) console.log(ry) console.log(rect.width) console.log(rect.height) } } }
This file contain errors, but when runed from QtCreator you can see in Application Output, that prints do not have any information about errors from readAllStandardError() and exit code is -1.
But if you replace this file with one that has only warning:
import QtQuick 2.15Item {id: root width: 100 height: 100rectangle { id: rectangle anchors.fill: parent color: "blue" MouseArea { anchors.fill: parent onClicked: { rectangle.color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1); } } } }
You will get exitCode 0, and readAllStandardError() will properly have information about warnings.
The only exception to that i when we use "–json " (with dash instead of json filename). Then the output has proper information about errors. But in json format which is not always wanted.
Attachments
Gerrit Reviews
For Gerrit Dashboard: QTBUG-137029 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
648680,1 | QColorOutput: flush stderr on destruction | dev | qt/qtdeclarative | Status: NEW | 0 | 0 |