Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-137029

Qmllint as process on Windows do not populate error channel unless called in terminal.

XMLWordPrintable

    • e365250e9 (dev), 063871f22 (6.10), f3d5e44df (dev), 0cf7d97ed (6.9), 0e0ca3792 (tqtc/lts-6.8), 5bd55b5c9 (6.10), 4ff1ce57c (6.9), 2ba1bbcc9 (tqtc/lts-6.8)

      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.

       

       

        1. Archive.zip
          2 kB
          Sami Shalayel
        For Gerrit Dashboard: QTBUG-137029
        # Subject Branch Project Status CR V

            sami.shalayel Sami Shalayel
            kchrusciel Krzysztof Chrusciel
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: